How can I use rvm to install a specific version of Ruby, e.g. 1.9.3p327 instead of the current 1.9.3p194 that I have.
All the references and document are about the major version, e.g. rvm install 1.9.3 but don't mention the 'p' minor version numbers.
I tried
$ rvm install 1.9.3p327
Unknown ruby interpreter version: '1.9.3p327'.
Could not detect ruby version/name for installation, please be more specific.
$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]
$ rvm install '1.9.3p327'
Unknown ruby interpreter version: '1.9.3p327'.
Could not detect ruby version/name for installation, please be more specific.
Turned out to be a dash ! $ rvm install 1.9.3-p327
rvm install 1.9.3p327 should work without single quotes.
EDIT: The following option is now deprecated.
Alternatly, to install a patch specific level you could use the -l option. For example
rvm install 1.9.3 -l 327
Related
When I try to run a ruby command in terminal I get an error:
Ruby >= 2.1.9 required to run app (You have 2.0.0)
When I try
brew upgrade ruby
I get
Error: ruby 2.3.1 already installed
Previously I tried installing ruby with rvm
curl -sSL https://get.rvm.io | bash -s stable --ruby
Maybe I have two different versions of ruby running?
How can I get my system to use the latest version of ruby?
EDIT: Definitely two versions installed
/usr/local/bin/ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin14]
ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
My $PATH seems correct?
-bash: /usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin: No such file or directory
EDIT2 specifying the full path to the correct version of ruby:
/usr/local/bin/ruby app.rb
/usr/local/bin/ruby: No such file or directory -- app (LoadError)
In the simplest cases, you can just specify the fully-qualified PATH to your Homebrew-installed Ruby. For example:
/usr/local/bin/ruby /path/to/foo.rb
However, if you need to require gems or libraries, you need to step up your game with a Ruby version manager such as chruby, rvm, or rbenv. You should never replace the system ruby, and managing all the environments variables, gems, and so forth that Ruby needs without a version manager is outside the scope of a reasonable Stack Overflow question.
You have installed the homebrew version 2.3.1 of Ruby, but you are not using it because you haven't set your PATH correctly.
Try using the one homebrew installed for you by adding /usr/local/bin to the start of you PATH, or by running:
/usr/local/bin/ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
I guess if you use the Apple-supplied Ruby in /usr/bin you will get:
/usr/bin/ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]
You should uninstall ruby from brew and just use rvm.
If you have multiple version installed than you can use rvm to make ruby 2.3.1 your default: rvm --default use 2.1.1
I installed ruby via
apt-get install ruby1.9.1 rubygems
However, when I run ruby --version I see
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
Have I missed something? When I try to run a gem which requires 1.9+ it fails and asks me to upgrade.
The package ruby1.9.1 will give you an executable called ruby1.9.1, which you should use instead of ruby.
You can set ruby1.9.1 as default ruby version using following command
update-alternatives --set ruby /usr/bin/ruby1.9.1
You may find out about available alternatives using following
update-alternatives --query ruby
In this way you can set the default ruby version
$ rvm --default use 1.9.2
$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]
I managed to use rvm (Ruby Version Manageer) to update to the latest Ruby version (ruby-1.9.2-p180). To do this I ran the following commands:
rvm install ruby-1.9.2-p180
rvm ruby-1.9.2-p180
ruby -v
The output of that last command indicates that it is successfully installed:
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.0]
Running a "which ruby" command indicates that I'm using the correct Ruby version as well:
/Users/Bijan/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
So in the current Terminal session, the new Ruby is installed properly. However, whenever I open a new Terminal session, it defaults me back to the original version I was running:
ruby -v
ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.6.0]
which ruby
/usr/local/bin/ruby
So, in other words, I seem to have to different versions properly installed, but the default is going to the /usr/local/bin instead of the RVM installation. How do I go about making sure that the default Ruby version that I am using is the most recent?
You can set your default ruby version to be the latest with the following:
rvm --default use <ruby version here>
By default, the system ruby is your default in RVM
create a .rvmrc file under the directory (~/ in your case) which includes the following:
rvm use ruby-1.9.2-p180
save it and you are good to go.
I ran the command 'ruby -v' on my Linux Mint 10 virtual machine and got:
stapiagutierrez#Sergio-Linux-VM ~/Desktop/Tickets/tickets $ ruby -v
ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-linux]
How can I upgrade it to the latest version, 1.9.2?
I would suggest using RVM. That way you can keep the 1.8.7 version of Ruby, but you can also install new ones easily:
rvm install 1.9.2
And switch between them with no effort:
rvm 1.8.7
rvm 1.9.2
Using rvm you can set your default version of Ruby like this:
rvm --default use 1.9.2
I've got Xcode 3.2.1
I've installed Git and RVM
I've installed Ruby 1.9.2, it's installed 100%
I run ruby -v but instead of seeing
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]
I see
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
I don't see what I could be going wrong
Try
rvm 1.9.2
Or
rvm --default 1.9.2
It is possible to use a .rvmrc to do that for the directory you cd into as well.
Have you selected the version of ruby you want to use with rvm? As in this? Note the "rvm 1.9.2" line hidden away after the rvm and ruby installs.
Type in 'rvm 1.9.2' and then type 'ruby -v'... did you do that? It looks like the Ruby 1.8.7 on your machine is the one included with OS X.