Linux
To install different version of ruby, check the latest version of package using apt
as below:
$ apt-cache madison ruby
ruby | 1:1.9.3 | http://ftp.uk.debian.org/debian/ wheezy/main amd64 Packages
ruby | 4.5 | http://ftp.uk.debian.org/debian/ squeeze/main amd64 Packages
Then install it:
$ sudo apt-get install ruby=1:1.9.3
To check what's the current version, run:
$ gem --version # Check for the current user.
$ sudo gem --version # Check globally.
If the version is still old, you may try to switch the version to new by using ruby version manager (rvm
) by:
rvm 1.9.3
Note: You may prefix it by sudo
if rvm
was installed globally. Or run /usr/local/rvm/scripts/rvm
if your command rvm
is not in your global PATH
. If rvm installation process failed, see the troubleshooting section.
Troubleshooting:
If you still have the old version, you may try to install rvm (ruby version manager) via:
sudo apt-get install curl # Install curl first
curl -sSL https://get.rvm.io | bash -s stable --ruby # Install only for the user.
#or:# curl -sSL https://get.rvm.io | sudo bash -s stable --ruby # Install globally.then if installed locally (only for current user), load rvm via:
source /usr/local/rvm/scripts/rvm; rvm 1.9.3
if globally (for all users), then:
sudo bash -c "source /usr/local/rvm/scripts/rvm; rvm 1.9.3"
if you still having problem with the new ruby version, try to install it by rvm via:
source /usr/local/rvm/scripts/rvm && rvm install ruby-1.9.3 # Locally.
sudo bash -c "source /usr/local/rvm/scripts/rvm && rvm install ruby-1.9.3" # Globally.if you'd like to install some gems globally and you have rvm already installed, you may try:
rvmsudo gem install [gemname]
instead of:
gem install [gemname] # or:
sudo gem install [gemname]
Note: It's prefered to NOT use sudo to work with RVM gems. When you do
sudo you are running commands as root, another user in another shell
and hence all of the setup that RVM has done for you is ignored while
the command runs under sudo (such things as GEM_HOME, etc...). So to
reiterate, as soon as you 'sudo' you are running as the root system
user which will clear out your environment as well as any files it
creates are not able to be modified by your user and will result in
strange things happening.
No comments:
Post a Comment