Skip to content

Instantly share code, notes, and snippets.

@ollietreend
Created June 25, 2022 11:20
Show Gist options
  • Save ollietreend/141ec702c14882f0690ea99413d518da to your computer and use it in GitHub Desktop.
Save ollietreend/141ec702c14882f0690ea99413d518da to your computer and use it in GitHub Desktop.
Uninstall all gems from all Ruby versions managed by rbenv
#!/usr/bin/env bash
# Uninstall all gems from all Ruby versions managed by rbenv
uninstall_gems() {
gems=$(gem list --no-versions)
for gem in $gems; do
gem uninstall $gem -aIx
done
gem list
gem install bundler
}
ruby_versions=$(rbenv versions --bare)
for version in $ruby_versions; do
echo '---------------------------------------'
echo $version
rbenv local $version
uninstall_gems
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment