How to uninstall a specific version of Rails from your development machine
This minipost will guide you through all the required steps to successfully uninstall a specific version of Rails from your development system. Trying only to uninstall
gem rails is not sufficient, you also need to uninstall
Initially, you should check what is your global version of Rails that runs on your system by checking:
Depending on the version you have you will get an output of the following form:
Next, you should check for versions of rails you have already installed on your system. You can do that with the following command:
gem list rails
Depending on the versions you have installed, you will get an output similar to the following:
*** LOCAL GEMS *** ... ... rails (6.1.0, 220.127.116.11, 5.2.3) ... ...
Now, uninstall a specific version of Rails that is already installed by:
gem uninstall rails -v '6.1.0'
Feel free to change
'6.1.0' with the version you want to uninstall. The above command will output:
Successfully uninstalled rails-6.1.0
Now, check again the global version of Rails by:
Although you have uninstalled the version 6.1.0, the output you will get is still:
To get the latest installed version of Rails as your global default in your system you need to uninstall also the gem railties. Now, check what versions of
railties gem are already on your system by:
gem list railties
*** LOCAL GEMS *** railties (6.1.0, 18.104.22.168, 5.2.3)
gem railties with version
6.1.0 is still installed and as a result, you need to uninstall it by:
gem uninstall railties -v '6.1.0'
Again, depending on the version you are trying to uninstall, you will get a message similar to the following:
You have requested to uninstall the gem: railties-6.1.0 web-console-4.1.0 depends on railties (>= 6.0.0) If you remove this gem, these dependencies will not be met. Continue with Uninstall? [yN]
Confirm the uninstall by entering
y and pressing
ENTER. This will output the following to your console:
Successfully uninstalled railties-6.1.0
Finally, check now the global rails version on your system by:
That will no longer output 6.1.0:
Having completed the above steps, your system will have as global version, the highest version already installed to your system.