Last Updated: February 25, 2016
· _ismaelga

Delete ALL your installed gems

Recently I realised I had +1GB of gems installed so I decided to uninstall all of them. I did this by deleting the gem folder content, but guess what?? Seems it's not the way to go, bundler says I have gems installed and running any gem command resulted on an error ofcourse because the files aren't there anymore.

First lets check the size of the gems folder with this command

du -h -d 0 `gem environment gemdir`

So, here is my tip for you! If you need/want to delete your gems use this command

gem list | cut -d" " -f1 | xargs gem uninstall -aIx

You now have a clean gems folder, more free space and probably a more responsive ruby system.

Thanks to

Happy cleanup! :)

2 Responses
Add your response

How to check the size (from CLI)?

over 1 year ago ·


You can use this command :) I'm actually going to create a new protip for this.

du -h -d 0 `gem environment gemdir`
over 1 year ago ·