Reputation: 11609
I have some conflicts of ruby version.
When I run ruby -v
in my terminal (in osx), I get the 1.8.7 version
. I tried to upgrade ruby version, installing rvm, with this command curl -L https://get.rvm.io | bash -s stable --autolibs=3 --rails
. Then I tried to run rvm install ruby-1.9.3-p362
, and I was told that rvm was not a found command. So I ran source /Users/host/.rvm/scripts/rvm install ruby-1.9.3-p362
, this worked and when I run in my bash ruby -v
, I get ruby 2.0.0
. But it seems to be related to my current terminal session since when I run ruby -v
in another session, I always get 1.8.7 version
. How can I set on my .bash_profile
(or elswhere) the right version of ruby (and of rails) ?
Upvotes: 0
Views: 1198
Reputation: 53158
You need to enable login shell in your terminal emulator, here is example how to set it up in gnome-terminal https://rvm.io/integration/gnome-terminal/
Upvotes: 0
Reputation: 1293
You should set the default ruby via rvm: https://rvm.io/rubies/default/
rvm --default use <ruby_version>
Upvotes: 0
Reputation: 6871
RVM allows to install multiple versions of ruby on a single *nix box. Each ruby version is kinda sandboxed from another one. For the first time, you will need to specify a default version of ruby. This will be needed only for the first time.
rvm use 1.9.3-p290 --default
To switch to another version, simply type:
rvm use 1.9.2
Rails is just a gem. To get the most out of RVM, create a gemset and install all gems for one ruby version within one gemset. i.e. one gemset per ruby version. This works like :
rvm gemset create my_gem_set
Gemset 'my_gem_set' created.
rvm gemset use my_gem_set
You can also use .rvmrc file in your project directory to 'load' just the required gems for your app. There is one .rvmrc per project. You can refer rvm.io for docs on rvmrc
Upvotes: 3