- Homebrew
- SOURCES
brew update
- Update brew itself and get new versions of formulas
brew upgrade [formula]
- Upgrade all or specified formula to latest version
brew cleanup [-n]
- Remove old installed versions of formulas
-n
to see what will happened
brew prune [-v]
- Clean brew symlinks
-v
to see what will happened
brew missing
- List missing dependencies. Output format "formula: missing dependency"
brew doctor
- List of potential problems. You dont need to worry about it unless something makes real problem.
- Clean cache
- Downloaded source files of formulas
- There is no direct command to do it
rm -rf
brew --cache/*
- Stop formula from being updated
brew pin formula
- Start formula to update again
brew unpin formula
- Cask
- located
/opt/homebrew-cask/Caskroom
brew cask cleanup
- located
- TIPS
- Problem with Error: /usr/local must be writable!
- Homebrew/legacy-homebrew#49895
- TODO: not sure which of next is better :)
sudo chown -R $(whoami):admin /usr/local
sudo chgrp -R admin /usr/local
sudo chmod -R g+w /usr/local
- Problem with Error: /usr/local must be writable!
- RVM
- SOURCES
rvm gemset empty GEMSET-NAME
- Empty gemset with given name
rvm gemset delete GEMSET-NAME
- Remove whole gemset
rvm remove RUBY-VERSION
- Remove whole ruby version and all gemsets
rvm cleanup all
- It removes source files, archives, log, tmp, links, etc
- TIPS:
- Enable global gem cache to keep each gem only once across all ruby versions and gemsets
rvm gemset globalcache enable
- gem means activerecord-5.0.0.beta3.gem (source file)
- Enable global gem cache to keep each gem only once across all ruby versions and gemsets
- Bundler
- http://bundler.io/v1.1/bundle_clean.html
bundle clean [—force]
- Cleanup outdated gems (keep only gems in Gemfile.lock)
- NOTE: cleaning is performed on active ruby version and gemset
- System scripts
- TIPS:
- Every following scripts and much more can be performed via awesome application Onyx
- http://www.titanium.free.fr/onyx.html
- Verify & Repair disk
- http://osxdaily.com/2014/01/27/verify-disk-command-line-mac-os-x/
- WARNING: can really slow (and block) computer for a while
- verify:
diskutil verifyvolume /
- repair:
diskutil repairvolume /
- for external disk
diskutil verifyvolume|repairvolume /Volumes/ExternalBackups/
- Verify & Repair permissions
- http://osxdaily.com/2015/11/04/verify-repair-permissions-mac-os-x/
- WARNING: can really slow (and block) computer for a while
- verify:
sudo /usr/libexec/repair_packages --verify --standard-pkgs /
- repair:
sudo /usr/libexec/repair_packages --repair --standard-pkgs --volume /
- Daily, Weekly and monthly scripts
- As you can guess, it is scripts which are run periodically. You can run them:
sudo periodic daily weekly monthly
- TIPS:
- System and program files (from source codes, homebrew etc)
- Logs
/usr/local/var/log
- Can be cleaned without any problem
rm /usr/local/var/log/**/*.log && rm /usr/local/var/log/*.log
- TODO: better glob to match all
- Data
/usr/local/var
(like databases etc)- Remove only what you dont use
- old versions of databases
- data for already uninstalled software
- TIP: in some cases mysql wont release space after you drop database or remove table. Follow any solution noticed there https://stackoverflow.com/questions/4338645/free-space-in-mysql-after-deleting-tables-columns
- Remove only what you dont use
- Old Java versions
/Library/Java/JavaVirtualMachines/
contains files like jdk1.8.0_66.jdk etc.- Check your current version java -version
- Remove rest with sudo
rm -rf /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk
- Logs
- OSX files
/System/Library/Speech
- You can remove Recognizers or Text to Speech voices which you dont use
- Installed software (receipts)
- SOURCE
- locations
/private/var/db/receipts/
/Library/Receipts/
~/Library/Receipts/
- Information about receipt
pkgutil --pkg-info package-id
- example:
pkgutil --pkg-info com.apple.pkg.Pages5
- example:
- Remove package receipt
sudo pkgutil --forget package-id
- example:
sudo pkgutil --forget com.apple.pkg.Pages5
- example:
/private/var/folders
- https://discussions.apple.com/thread/3757828?tstart=0
- https://apple.stackexchange.com/questions/176371/can-i-delete-private-var-folders-bf
- quit all applications
sudo rm -rf /private/var/folders/*
- reboot system to recreate all necessary files
/var
is symlinked to/private/var
Last active
November 20, 2024 17:47
-
-
Save schovi/da0e99e849b7c32271e1f818d0c704e1 to your computer and use it in GitHub Desktop.
My collection of resources how to keep your mac fresh, fast and with lot of disk space. Still **WORK IN PROGRESS**. If you have any comments and tips, give me comment. Like how to clean after python, clojure, etc etc
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment