I'm trying to upgrade Ruby to 1.8.7 on Fedora 13 (yes I know it's old) using rvm. I'm a little new to the Ruby world, but this is what I've done so far:
~$ yum -y install rubygem-rvm
...
~$ rvm-install
...
~$ rvm install 1.8.7
/usr/local/rvm/rubies/ruby-1.8.7-p302, this may take a while depending on your cpu(s)...
ruby-1.8.7-p302 - #fetching
ruby-1.8.7-p302 - #extracted to /usr/local/rvm/src/ruby-1.8.7-p302 (already extracted)
ruby-1.8.7-p302 - #configuring
ruby-1.8.7-p302 - #compiling
ruby-1.8.7-p302 - #installing
ruby-1.8.7-p302 - #rubygems installing to ruby-1.8.7-p302
ruby-1.8.7-p302 - adjusting #shebangs for (gem).
ruby-1.8.7-p302 - #importing default gemsets (/usr/local/rvm/gemsets/)
Install of ruby-1.8.7-p302 - #complete
~$ rvm use 1.8.7 --default
Using /usr/local/rvm/gems/ruby-1.8.7-p302
~$ ruby -v
ruby 1.8.6 (2010-09-02 patchlevel 420) [x86_64-linux]
~$ rvm use 1.8.7
Using /usr/local/rvm/gems/ruby-1.8.7-p302
~$ ruby -v
ruby 1.8.6 (2010-09-02 patchlevel 420) [x86_64-linux]
Everything seems to run fine, except Ruby 1.8.6 is still the default version.
What other steps am I missing to switch the default Ruby version to 1.8.7?
EDIT: It seems there's some really unintuitive behavior in rvm. If you don't install certain packages, then when you use rvm to install a specific Ruby version, rvm not only won't build or install that Ruby version, it won't even tell you it's not building Ruby. I noticed there was no bin directory in /usr/local/rvm/gems/ruby-1.8.7-p302...which was unusually, being that Ruby is a binary and all. So I double checked the docs, and found a list of Fedora packages to install:
yum install -y bash curl git
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel
yum install -y iconv-devel
After those were installed, running rvm install 1.8.7 correctly built a Ruby binary. Oddly, running rvm use 1.8.7 --default still doesn't update the default Ruby version, so I did:
cp /usr/bin/ruby /usr/bin/ruby-1.8.6
rm -f /usr/bin/ruby
ln -s /usr/local/rvm/rubies/ruby-1.8.7-p302/bin/ruby /usr/bin/ruby
Be sure to run ruby -v in the same shell where you ran rvm use 1.8.7. I'm not sure what the --default option does so try leaving it off.
Not positive, this could be a few things. My guess is this though.
You might need to switch the linker to point at your new installation (the "shortcut" file in /usr/bin/). Find where you installed your new version of ruby. If the "ruby" linker in /usr/bin/ does not point to this new installation, make a new link by right-clicking on the ruby executable and make a link, put it /usr/bin/.
That's my only guess, I had this problem when I installed a new version of python.
Related
I want to install the compass html5 boilerplate gem. When I try to install it I get the following error.
$ sudo gem install html5-boilerplate
ERROR: Error installing html5-boilerplate:
compass-h5bp requires Ruby version ~> 2.0.
Then when I check my ruby version it says:
$ ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
But I used RVM before so I thought I could just change version but when I check it says I'm using ruby-2.2.0 already.
$ rvm list
rvm rubies
=* ruby-2.2.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
I think I must be missing something obhvious, it's been a while since I've worked with Ruby and RVM.
Update 1
I ran the below commands as suggested by #tadman and it does seem the wrong path is being used.
~:$ cd ~/.rvm/bin
bin:$ ls
ruby-rvm-env rvm rvm-auto-ruby rvm-exec rvm-prompt rvm-shebang-ruby rvm-shell rvm-smile rvmsudo
bin:$ which ruby
/usr/bin/ruby
UPDATE 2
After correcting the path in my .bash_profile the ruby version seems correct but I'm still getting the same error when trying to install the html5-boilerplate gem??
$ sudo gem install html5-boilerplate
ERROR: Error installing html5-boilerplate:
compass-h5bp requires Ruby version ~> 2.0.
$ ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
$ rvm list
rvm rubies
=* ruby-2.2.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
$ compass -v
Compass 1.0.3 (Polaris)
Copyright (c) 2008-2015 Chris Eppstein
Released under the MIT License.
Compass is charityware.
Please make a tax deductable donation for a worthy cause: http://umdf.org/compass
Also i have the compass gem installed on both Ruby 1.9.1 and RVM's ruby 2.2.0. Could this have something to do with it?
$ pwd
/var/lib/gems/1.9.1/gems/compass-1.0.3
$ cd /home/ross/.rvm/gems/ruby-2.2.0/gems/compass-1.0.3
$ pwd
/home/ross/.rvm/gems/ruby-2.2.0/gems/compass-1.0.3
Is there a way to check which ruby version compass is using?
Having RVM and having RVM installed correctly are two different things. The most common cause of a mismatch like this is that your system Ruby has priority in your PATH.
In a POSIX shell, which ruby will tell you which one is getting executed. It is probably the wrong one.
RVM does its magic by manipulating which Ruby shows up in the RVM bin path, often ~/.rvm/bin or something similar. To get it to work correctly you'll need to ensure that path is first in your $PATH.
You may want to try reinstalling the RVM stub, or check that it's correctly loaded into your environment.
When I try to install the 1.8.7 version of Ruby:
rvm install 1.8.7
He actually install Ruby 1.8.7-head (1.8.7 patchlevel 376).
How can I install the real first version (http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7.tar.gz)?
Try this:
rvm install 1.8.7 -l 0
or
rvm install 1.8.7-p0
RVM is installing the latest patchlevel by default, so you need to specify the patchlevel that you want.
I'm trying to install cocaopods on my Mac Yosemite system. However, when I type in this command:
$ sudo gem install cocoapods
It returns this error:
ERROR: Error installing cocoapods:
i18n requires Ruby version >= 1.9.3.
Typing which ruby, returns:
/Users/myname/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
typing rvm rubies gives this message:
rvm rubies
ruby-1.8.7-p334 [ x86_64 ]
=> ruby-1.9.2-p180 [ x86_64 ]
However, typing /usr/bin/ruby --version gives this message:
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
I'm thinking if I can uninstall the ruby that's in my home directory, the cocoapods install will find the more recent ruby version. However, I'm not not sure exactly how to do that and/or what impact it would have. Any suggestions?
Looks like you have rvm installed when you don't want to. You can remove it entirely with rvm implode. Then when you open a new shell which -a ruby should just show /usr/bin/ruby
I'm having an issue with RVM that I haven't seen before. I'm trying to install ruby 1.9.3 but it installs a binary version instead of compiling:
rvm install 1.9.3
Searching for binary rubies, this might take some time.
ruby-1.9.3-p362 - #configure
ruby-1.9.3-p362 - #download
ruby-1.9.3-p362 - #validate archive
tar: Record size = 8 blocks
tar: Record size = 8 blocks
ruby-1.9.3-p362 - #extract
ruby-1.9.3-p362 - #validate binary
ruby-1.9.3-p362 - #setup
Saving wrappers to '/home/vagrant/.rvm/bin'.
ruby-1.9.3-p362 - #importing default gemsets, this may take time ...
Then if I try
$ rvm use 1.9.3
$ ruby -v
$ ruby 1.9.3p362 (2012-12-25 revision 38607) [i686-linux]
However, there are no sources:
$ ls .rvm/src/
ruby-1.8.7-p371 rubygems-1.8.24 rvm yaml-0.1.4
Is there any reason why RVM is not compiling ruby 1.9.3?
Thanks for your help!
Compiling ruby takes time, RVM provides binary rubies so Ruby can be installed faster and that no compilations errors break installation.
You could check rvm help install where first line is:
Usage
rvm install {ruby-string} [--verify-download {0,1,2}] [--binary|--disable-binary|--movable]
so it's enough to use:
rvm reinstall 1.9.3 --disable-binary
but if you only need sources then run:
rvm fetch 1.9.3
I have ruby 1.8.7 and 1.9.3 installed by rvm. For each ruby version, I'd like to:
use gem 1.3.7 for ruby 1.8.7
use gem 1.8.x for ruby 1.9.3
How can I set the above in rvm?
$ rvm use 1.8.7
$ rvm rubygems 1.3.7
$ rvm use 1.9.3
$ rvm rubygems latest-1.8
$ gem -v
1.8.24
$ rvm use 1.8.7
$ gem -v
1.3.7
When install rvm and then rvm install ruby --version its taken latest rubygems version. So just follow the below steps:
rvm use 1.8.7
gem -v, e.g. shows 1.8.24 like that
If you want to use rubygems particular version only follow steps #3 and #4.
This is for syntax set the rubygems in rvm
rvm rubygems [x.y.z|latest-x.y|latest|remove]
Ex like this:
Retrieving rubygems-1.3.7
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 284k 100 284k 0 0 94166 0 0:00:03 0:00:03 --:--:-- 125k
Extracting rubygems-1.3.7 ...
Removing old Rubygems files...
Installing rubygems-1.3.7 for ruby-1.8.7-p371 ...
Installation of rubygems completed successfully.
then
gem -v => It shows 1.3.7
rvm rubygems 1.3.7
And If you want use any other version go to step #3
Ex: rvm rubygems latest
If you have already created gemsets in rvm for 1.3.7 and 1.8.x, skip this step. Otherwise, you need to create the gemset.
Here is how to create a gemset and then switch to it:
rvm 1.8.7 # switch to ruby 1.8.7
rvm gemset create 1.3.7 # you may have to do it this way: rvm --force rubygems 1.3.7
rvm gemset use 1.3.7 # use it
Next time you want to use ruby 1.8.7 with gemset 1.3.7 you only need to do this:
rvm use 1.8.7#1.3.7 # this sets the ruby version and gem version
ruby -v # checks the ruby version, should = 1.8.7
gem --version # checks the gemset version, should = 1.3.7
Repeat this for ruby 1.9.3 and gemset 1.8.x.
You can find out how to do this and find answers to questions other rvm related topics here: http://rvm.io/gemsets/using