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 cleanup removes older versions of installed gems, keeping the newest. Project-specific gems installed by Bundler into a project folder can be deleted with the project's vendor/bundle folder and reinstalled later.
  • PHP: composer clear-cache empties Composer's download cache. Each project's vendor folder can be deleted and restored with composer install.

Run them from Terminal; neither touches your source code.

Last reviewed

Also available as Markdown and JSON.