Skip to content

Instantly share code, notes, and snippets.

@dlbock
Forked from IanVaughan/uninstall_gems.sh
Last active December 30, 2017 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlbock/bba5919db0ebbd83816edb3d77c3d62f to your computer and use it in GitHub Desktop.
Save dlbock/bba5919db0ebbd83816edb3d77c3d62f to your computer and use it in GitHub Desktop.
Uninstall all rbenv gems
#!/usr/bin/env bash
#
# Originally from https://gist.github.com/IanVaughan/2902499
uninstall() {
list=`gem list --no-versions`
for gem in $list; do
gem uninstall $gem -aIx
done
gem list
gem install bundler
}
## To uninstall ALL the gems for a specific ruby version
RUBY_VERSION=#2.2.6 or whatever your version is
rbenv local $RUBY_VERSION
uninstall
## To uninstall ALL the gems for ALL your ruby versions
#rbenv versions --bare
RBENVPATH=`rbenv root`
echo $RBENVPATH
RUBIES=`ls $RBENVPATH/versions`
for ruby in $RUBIES; do
echo '---------------------------------------'
echo $ruby
rbenv local $ruby
uninstall
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment