Skip to content

Instantly share code, notes, and snippets.

@lukebakken
Created August 1, 2016 20:01
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 lukebakken/075e97519cfb3c04650a4191844592f4 to your computer and use it in GitHub Desktop.
Save lukebakken/075e97519cfb3c04650a4191844592f4 to your computer and use it in GitHub Desktop.
Remove all gems in your rbenv environment
#!/usr/bin/env bash
RBENV_ROOT="$HOME/.rbenv"
if [[ -d "$RBENV_ROOT/bin" ]]
then
export RBENV_ROOT
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
else
echo "Expected to find rbenv in $RBENV_ROOT!" 2>&1
exit 1
fi
function uninstall
{
for gem in $(gem list --no-versions)
do
gem uninstall "$gem" -aIx
done
gem list
gem install bundler
}
if [[ $@ ]]
then
RUBIES="$@"
else
RUBIES="$(rbenv versions --bare)"
fi
for ruby in $RUBIES; do
echo '---------------------------------------'
echo $ruby
(rbenv shell $ruby && uninstall) &
done
echo -n 'Waiting...'
wait
echo 'DONE!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment