Skip to content

Instantly share code, notes, and snippets.

@cesarfigueroa
Last active December 19, 2015 04:19
Show Gist options
  • Save cesarfigueroa/5896422 to your computer and use it in GitHub Desktop.
Save cesarfigueroa/5896422 to your computer and use it in GitHub Desktop.
Uninstall all gems in Ruby 2.x
#!/usr/bin/env sh
gems=`gem list --no-versions`
default_gems=(bigdecimal io-console json minitest psych rake rdoc test-unit)
for gem in $gems; do
if [[ ${default_gems[*]} != *$gem* ]]; then
gem uninstall $gem -aIx
fi
done
@cesarfigueroa
Copy link
Author

As of version 2.1.0, you can simply do gem uninstall -aIx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment