Mac storage basics · Programming languages and toolchains
How do I clean up old Ruby gems and PHP Composer caches?
Short answer: Run gem cleanup to remove old gem versions and composer clear-cache to empty Composer's download cache. Project vendor folders can be deleted and reinstalled.
Both keep old versions and downloads around:
- Ruby:
gem cleanupremoves older versions of installed gems, keeping the newest. Project-specific gems installed by Bundler into a project folder can be deleted with the project'svendor/bundlefolder and reinstalled later. - PHP:
composer clear-cacheempties Composer's download cache. Each project'svendorfolder can be deleted and restored withcomposer install.
Run them from Terminal; neither touches your source code.