I'm trying to update Ruby from 2.0 to 2.4. The installation went through, but when I type in terminal ruby -v I'm shown the following:
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
I have no clue on how override the old version. Any assistance would be awesome.
To make ruby 2.4.0 as your default ruby version :
rvm --default use 2.4.0
Now , ruby -v will show ruby-2.4.0
If not installed already then Run:
rvm install ruby-2.4.0
Reference : rvm documentation
In case of chruby, Run
chruby ruby-2.4.0
to make ruby-2.4.0 as default version
Related
I used to use rbenv to manage ruby versions. I uninstalled it because I had to switch to rvm to install an old version of ruby. Now in my project, if I do ruby -v I get ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux] but when I try to create my database with bundle exec rails db:create I get rbenv: version '2.3.1' is not installed. Can someone help me with that ?
When I run
ruby -v
i get ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]
this is after installing the latest version of ruby with brew install ruby
tried uninstalling and reinstalling and same thing. How can I get the latest version of ruby? If relevent, I need it for gem install bundler which requires a later version.
This is how to update your ruby version steps
To check what your ruby in now
$Ruby -v
Update it to ruby version 2.3.7
$rvm list known
$rvm install 2.3.7
$rvm use 2.3.7 --default
$gem install bundler
Let me know if does that help!
I am just starting to work on an old Ruby Rails project. The Gemfile specifies:
ruby '2.0.0'
I am running a new version of Ubuntu, which I think came with Ruby 2.3 as the default. So I install RVM and then I:
rvm --default use 2.0.0
ruby -v
which gives me:
ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-linux]
then I run:
bundle install
and I get this error:
Your Ruby version is 2.3.1, but your Gemfile specified 2.0.0
How do I get RVM to enforce the correct version of Ruby?
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 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.