Skip to content

Instantly share code, notes, and snippets.

@schovi
Last active February 8, 2024 01:58
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schovi/da0e99e849b7c32271e1f818d0c704e1 to your computer and use it in GitHub Desktop.
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
  • 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
    • 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
  • 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)
  • Bundler
  • System scripts
    • TIPS:
    • Verify & Repair disk
    • Verify & Repair permissions
    • 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
  • 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)
    • 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
  • OSX files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment