Reputation: 9949
I have many rubies installed by ruby-install under ~/.rubies
:
ls .rubies
ruby-1.9.3-p545 ruby-2.0.0-p598 ruby-2.1.3 ruby-2.1.5
ruby-2.0.0-p451 ruby-2.1.2 ruby-2.1.4 ruby-2.2.0
I want to uninstall one of the ruby installed by ruby-install, How do I do that?
Upvotes: 32
Views: 118614
Reputation: 1
Removes all associated ruby packages
sudo apt remove ruby
Upvotes: -1
Reputation: 3532
Unfortunately appears that ruby-install
just downloads and compiles Ruby, with no option to remove it, unlike RVM
or rbenv
.
So, probably you'll need to run some manual commands here to delete all installed files.
Usually ruby-install
will install rubies in ~/.rubies/
folder.
If you're not sure which ruby was installed using ruby-install
, locate the file .installed.list
, as it has a list of installed files during Ruby install. If you want to quickly locate it, just run locate .installed.list
and you'll get a short list of them.
Then run a cat
on the file located at the version you want to remove, to make sure which is the root folder for the ruby install you want to delete.
Then you can just remove the folder where the target version is located.
If you want to remove ruby-1.9.3-p545
, run:
rm -Rf ~/.rubies/ruby-1.9.3-p545
If you want to remove installed gems, usually they're located at ~/.gem/ruby/
.
Upvotes: 27
Reputation: 1482
Based on the responses in a feature request, the best way to remove older ruby versions is to go back to the src
directory and run make uninstall
or rake uninstall
. By default, ruby-install
uses $HOME/src/ruby-$version
for unpacked sources of ruby versions during installation.
For example, removing ruby version 2.6.3:
cd $HOME/src/ruby-2.6.3/ && make uninstall
Unfortunately, even though this bug/request was opened in 2016, this feature is still not implemented in ruby-install
.
If you've installed the ruby version using the default locations, then you should be safe by removing the specific subfolder within $HOME/.rubies/
.
rm -rf $HOME/.rubies/ruby-2.6.3
It's worth noting that it may be necessary to manually remove any gems installed with that ruby version.
e.g.
rm -rf $HOME/.gem/ruby/ruby-2.6.3
Upvotes: 5
Reputation: 19
If you installed package 2.3x(+) and you need to uninstall it, there is an uninstall executable inside of the root directory. Go to C:/ and you'll see the ruby folder there, inside it there will be the unin.exe. This all depends on where you chose to install it.
Upvotes: 2
Reputation: 21
I had exactly the same problem with my lubuntu virtual machine! I went into the shell from the login screen (by pressing CNTR + ALT + F3
) and checked the versions of ruby and gem:
ruby -v
gem -v
then I run sudo apt-get purge -y ruby
as suggested by chad. It successfully removed both ruby and gem.
Then I rebooted with:
reboot
And I was able to log in normally again!
Upvotes: 2
Reputation: 9949
You just remove where the ruby is.
For example, uninstall ruby that installed by ruby-install (default installation location is ~/.rubies
):
rm ~/.rubies/ruby-2.2.0
If you see this kind of error after removed Ruby 2.2.0-preview2 and installed Ruby 2.2.0-p0 for example:
$ bundle -v
zsh: /Users/Juan/.gem/ruby/2.2.0/bin/bundle: bad interpreter:
/Users/Juan/.rubies/ruby-2.2.0-preview2/bin/ruby: no such file or directory
You need to run
gem pristin --only-executables
Because whenever a ruby is updated or perhaps moved/named, due to RubyGems is generating explicit #!/path/to/ruby
for all gem executables, will need to regenerate the gem bin stubs with the new path to the ruby executable.
Upvotes: 2
Reputation: 61
if you install soft by dpkg or yum, when to uninstall it, you also should use dpkg or yum to purge it.
for example, we want to unintall fcitx,
sudo apt-get purge -y fcitx
otherwise, the soft install manually, use configuration && make && make install , just remove the directory installed when you uninstall it.
for you example. just
rm -rf ~/.rubies/ruby-2.2.0
if you have doubts that is the target ruby remove clearly, just use find command to confirm.
find ~/ -name "ruby-2.2.0"
Upvotes: 1