I have installed RVM and it works. I can change the version of ruby and do all of the other things expected with RVM. however, if I close the current terminal window and open a new one, the new terminal window forgets about RVM. Here's an example:
After opening a new terminal window, I do the following:
$ ruby -v
ruby 1.9.3p484
$ source ~/.bash_profile
$ ruby -v
ruby 2.1.0p0
Ruby 2.1.0p0 is set as the default RVM version. it only loads properly after I reload bash_profile.
I am using Ubuntu with the kubuntu window manager. Any ideas??
what is the o/p of $rvm reload and $rvm notes after you open a new terminal.
Also check out $rvm list
This shows the list for ruby installation available with their version and the default currently being used. You can always change this using $rvm use 1.9.3 --default. If you want any specific version to be loaded for an application, edit the .rvmrc file specifying the ruby version to be used.
Related
I upgraded ruby from 2.2.3 using rbenv following these instructions
$ brew update
$ brew install ruby-build
$ brew install rbenv
$ rbenv install 2.5.0
$ rbenv global 2.5.0
$ rbenv local 2.5.0
i restarted my terminal and my computer but when i run
ruby -v
it shows that i have
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
when i run rbenv version
system
2.4.0
2.5.0 (set by /Users/****/.ruby-version)
it doesn't even show this version, i'm stuck on what i have to do to change this to point to the correct version.
When i run
$echo $PATH
it shows
-bash: /usr/local/opt/imagemagick#6/bin:/Users/****/.rvm/gems/ruby-2.2.3/bin:/Users/****/.rvm/gems/ruby-2.2.3#global/bin:/Users/****/.rvm/rubies/ruby-2.2.3/bin:/Users/****/anaconda/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/****/.rvm/bin: No such file or directory
From your path, it looks like you are using rvm. I think rvm and rbenv should not be both active on the same system. If you are going to use rbenv I suggest you disable rvm. You don't need to delete the .rvm directory containing rvm's rubies, gems, etc., you just need to stop the rvm shell code from being loaded when the terminal window starts up. To do this, disable or remove the rvm-related code in your .bashrc, .profile, .bash_profile, .zshrc, etc., and use a new terminal window that starts up after that removal.
I suspect the 2.2.3 version of Ruby is the system you see in the list. If you do a which ruby, you can see where it's located, and that will be a clue; if it's /usr/bin/ruby, then it's the system Ruby.
As an aside, you can get a list of directories in the PATH one to a line by using this command:
echo $PATH | tr : \\n
This would be much easier to follow than the long line containing all the directories.
I use rvm on my Ubuntu 14.04 machine and each time I start the terminal, the ruby version selected (from ruby -v) is ruby 1.9.3p551 . rvm --default use 2.2.3 lets me use the selected ruby version, but the entire process needs to be redone each time a new session is started.
How can this be resolved?
Check in your gemfile if there is a references to 1.9.3
If not, check this answer and follow the instructions How to set default Ruby version with RVM?
You can use the .ruby-version file.
This file checked by both ruby version managers, like rvm and rbenv.
For example you can place a file .ruby-version with 2.2.3 in the home directory ~/.ruby-version, it is should set the ruby version at 2.2.3 for any new terminal session. Also you can place a file .ruby-version in the project directory, /path/to/the/project/.ruby-version it is should set ruby version for project.
Just trying to update to the latest version of Ruby. On ruby-lang.org/en/documentation/installation/#homebrew, I found that you should be able to do it via homebrew:
brew install ruby
However, when I listed the ruby version (ruby -v) after it 'updated' it was still at the old version 2.0.0.
Hermes:~ Sancho$ ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin13]
I happened to list the contents of /usr/local/bin/ and I could see a symbolic link:
ruby -> ../Cellar/ruby/2.2.1/bin/ruby
So, I don't know what's happening and why the version still lists the old number and not 2.2.1, as it looks like it should.
There are sym links to for various other ruby tools (erb, gem, irb, rake, rdoc, ri) to version 2.2.1 also.
So what is happening here and how do I correctly install version 2.2.1?
I do have RVM installed also, but I want to update the system version of ruby to the latest.
Easy step
brew uninstall ruby # (if installed)
brew install ruby
then copy the path and paste into the terminal and restart the terminal
check ruby --version
Use Homebrew but make sure /usr/local/bin is early in your path. Ex:
.bashrc
export PATH=/usr/local/bin:$PATH
This will not update the system Ruby version. Instead it will install another version of ruby and this line tells bash to look for the new version instead.
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
$PATH doesn't change in current Terminal session. So please close the Terminal and reopen.
Ref: Jekyll on macOS
I type ruby -v and this shows
ruby version 2.1.5p273
but in my control panel, ruby version is 2.2.1-p85
I tried to change the version with rvm use ruby-2.2.1 in the terminal but it returns 'rvm' as not internal or external command.
I am using railsinstaller btw
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.