Skip to content

Instantly share code, notes, and snippets.

@ewalk153
Last active December 24, 2015 09:18
Show Gist options
  • Select an option

  • Save ewalk153/6775899 to your computer and use it in GitHub Desktop.

Select an option

Save ewalk153/6775899 to your computer and use it in GitHub Desktop.
Remove all gems matching a certain version number with a shell script
# simple bash script that unstalls a version of rails (this could break if you have other gems matching the exact version name)
# here we remove rails 4.0.0.rc1
# v1, simple
#gem list | grep 4.0.0.rc1 | awk -F= 'BEGIN {FS = " "} ; {print $1}' | while read x ; do gem uninstall $x -v 4.0.0.rc1 ; done
# v2, even shorter, no need for awk
gem list | grep 4.0.0.rc1 | while read name _; do gem uninstall $name -v 4.0.0.rc1 ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment