From 8c90548ad95221569f95bf15034e0f325760019c Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Mon, 15 Feb 2021 17:26:48 -0600 Subject: [PATCH] Add Uninstall Specific Version Of A Ruby Gem as a ruby til --- README.md | 3 ++- ...ninstall-specific-version-of-a-ruby-gem.md | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 ruby/uninstall-specific-version-of-a-ruby-gem.md diff --git a/README.md b/README.md index b42769c..72fd6d6 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket. For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud). -_1048 TILs and counting..._ +_1049 TILs and counting..._ --- @@ -896,6 +896,7 @@ _1048 TILs and counting..._ - [Turning Things Into Hashes](ruby/turning-things-into-hashes.md) - [Uncaught Exceptions In Pry](ruby/uncaught-exceptions-in-pry.md) - [`undef_method` And The Inheritance Hierarchy](ruby/undef-method-and-the-inheritance-hierarchy.md) +- [Uninstall Specific Version Of A Ruby Gem](ruby/uninstall-specific-version-of-a-ruby-gem.md) - [Unpacking Strings Into Binary](ruby/unpacking-strings-into-binary.md) - [Up And Down With Integers](ruby/up-and-down-with-integers.md) - [Use A Case Statement As A Cond Statement](ruby/use-a-case-statement-as-a-cond-statement.md) diff --git a/ruby/uninstall-specific-version-of-a-ruby-gem.md b/ruby/uninstall-specific-version-of-a-ruby-gem.md new file mode 100644 index 0000000..18bb60c --- /dev/null +++ b/ruby/uninstall-specific-version-of-a-ruby-gem.md @@ -0,0 +1,27 @@ +# Uninstall Specific Version Of A Ruby Gem + +I have two versions of `bundler` installed on my machine—`2.2.4` and `2.2.10`. +When I check the version of bundler, I see it references the latest one. + +```bash +$ bundle --version +Bundler version 2.2.10 +``` + +I want to get rid of `2.2.10` so that I can use `2.2.4` instead. This can be +done by uninstalling that specific version of `bundler`. + +To do this, specify the `-v` flag when running `gem uninstall`. + +```bash +$ gem uninstall bundler -v 2.2.10 +Successfully uninstalled bundler-2.2.10 +$ bundle --version +Bundler version 2.2.4 +``` + +Alternatively, if you want to use a different version of a gem without +uninstalling the primary version, you can [specify the version after the gem +name when calling it](run-an-older-version-of-bundler.md). + +[source](https://stackoverflow.com/questions/23887726/rails-uninstall-specific-version-of-a-library-using-gem)