I've set my default ruby version with
rvm use 1.9.3 --default
When opening a new terminal I can see that rvm remembers my default, however the old version of ruby is used:
Last login: Tue Jan 22 17:36:20 on ttys000
➜ ~ rvm list default
Default Ruby (for new shells)
ruby-1.9.3-p374 [ x86_64 ]
➜ ~ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
➜ ~ rvm info
ruby-1.9.3-p374:
system:
uname: "Darwin murzemac.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64"
system: "osx/10.8/x86_64"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12)"
zsh: "/bin/zsh => zsh 4.3.11 (i386-apple-darwin12.0)"
rvm:
version: "rvm 1.17.10 () by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "14 hours 46 minutes 38 seconds ago"
ruby:
interpreter: "ruby"
version: "1.8.7"
date: "2012-02-08"
platform: "universal-darwin12.0"
patchlevel: "2012-02-08 patchlevel 358"
full_version: "ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]"
homes:
gem: "/Users/murze/.rvm/gems/ruby-1.9.3-p374"
ruby: "/Users/murze/.rvm/rubies/ruby-1.9.3-p374"
binaries:
ruby: "/usr/bin/ruby"
irb: "/usr/bin/irb"
gem: "/usr/bin/gem"
rake: "/usr/bin/rake"
environment:
PATH: "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/murze/.rvm/bin"
GEM_HOME: "/Users/murze/.rvm/gems/ruby-1.9.3-p374"
GEM_PATH: "/Users/murze/.rvm/gems/ruby-1.9.3-p374:/Users/murze/.rvm/gems/ruby-1.9.3-p374#global"
MY_RUBY_HOME: "/Users/murze/.rvm/rubies/ruby-1.9.3-p374"
IRBRC: "/Users/murze/.rvm/rubies/ruby-1.9.3-p374/.irbrc"
RUBYOPT: ""
gemset: ""
How can 1.9.3 be automatically activated when opening a new terminal window?
My default doesn't always correctly set either, so I've put a .rvmrc in the directory my terminal opens at (or in dirs my terminal is likely to open at) with rvm use default inside.
Related
I have ruby 2.2.0 and I use RVM for a project that requires 2.0.0
After installing RVM I tried to use sass or compass gems outside the project and got this:
$ compass watch
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'compass' (>= 0) among 49 total gem(s) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /usr/bin/compass:22:in `<main>'
I tried removing RVM and reinstalling the gems and all worked fine, but I need it for the project.
Why is it looking in 2.0 folder? When I do rvm info I get ruby-2.2.0:
Update:
$ which ruby
/Users/ilyo/.rvm/rubies/ruby-2.2.0/bin/ruby
$ which compass
/usr/bin/compass
$rvm info
ruby-2.2.0:
system:
uname: "Darwin ilyo-audyx.local 14.0.0 Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64"
system: "osx/10.10/x86_64"
bash: "/bin/bash => GNU bash, version 3.2.53(1)-release (x86_64-apple-darwin14)"
zsh: "/bin/zsh => zsh 5.0.5 (x86_64-apple-darwin14.0)"
rvm:
version: "rvm 1.26.9 (latest) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "4 days 7 hours 57 minutes 33 seconds ago"
path: "/Users/ilyo/.rvm"
ruby:
interpreter: "ruby"
version: "2.2.0p0"
date: "2014-12-25"
platform: "x86_64-darwin14"
patchlevel: "2014-12-25 revision 49005"
full_version: "ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]"
homes:
gem: "/Users/ilyo/.rvm/gems/ruby-2.2.0"
ruby: "/Users/ilyo/.rvm/rubies/ruby-2.2.0"
binaries:
ruby: "/Users/ilyo/.rvm/rubies/ruby-2.2.0/bin/ruby"
irb: "/Users/ilyo/.rvm/rubies/ruby-2.2.0/bin/irb"
gem: "/Users/ilyo/.rvm/rubies/ruby-2.2.0/bin/gem"
rake: "/Users/ilyo/.rvm/rubies/ruby-2.2.0/bin/rake"
environment:
PATH: "/Users/ilyo/.rvm/gems/ruby-2.2.0/bin:/Users/ilyo/.rvm/gems/ruby-2.2.0#global/bin:/Users/ilyo/.rvm/rubies/ruby-2.2.0/bin:/Users/ilyo/.rvm/bin:/usr/local/bin:/Users/ilyo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
GEM_HOME: "/Users/ilyo/.rvm/gems/ruby-2.2.0"
GEM_PATH: "/Users/ilyo/.rvm/gems/ruby-2.2.0:/Users/ilyo/.rvm/gems/ruby-2.2.0#global"
MY_RUBY_HOME: "/Users/ilyo/.rvm/rubies/ruby-2.2.0"
IRBRC: "/Users/ilyo/.rvm/rubies/ruby-2.2.0/.irbrc"
RUBYOPT: ""
gemset: ""
I did this a few days ago:
$ rvm --default use 2.1.5
but then when I ran ruby -v today I got:
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
Is there a better way to permanently set the version of Ruby I use?
==== UPDATE
$ rvm use
Using /Users/snowcrash/.rvm/gems/ruby-2.1.5
$ which rvm
/Users/snowcrash/.rvm/bin/rvm
$ which ruby
/Users/snowcrash/.rvm/rubies/ruby-2.1.5/bin/ruby
and output of rvm info (note that ruby has reverted back to 2.0.0p481):
$ ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
$ rvm info
ruby-2.1.5:
system:
uname: "Darwin w.local 14.0.0 Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64"
system: "osx/10.10/x86_64"
bash: "/bin/bash => GNU bash, version 3.2.53(1)-release (x86_64-apple-darwin14)"
zsh: "/bin/zsh => zsh 5.0.5 (x86_64-apple-darwin14.0)"
rvm:
version: "rvm 1.26.9 (latest) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "8 days 7 hours 2 minutes 42 seconds ago"
path: "/Users/snowcrash/.rvm"
ruby:
interpreter: "ruby"
version: "2.0.0p481"
date: "2014-05-08"
platform: "universal.x86_64-darwin14"
patchlevel: "2014-05-08 revision 45883"
full_version: "ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]"
homes:
gem: "/Users/snowcrash/.rvm/gems/ruby-2.1.5"
ruby: "/Users/snowcrash/.rvm/rubies/ruby-2.1.5"
binaries:
ruby: "/usr/bin/ruby"
irb: "/usr/bin/irb"
gem: "/usr/bin/gem"
rake: "/Users/snowcrash/.rvm/gems/ruby-2.1.5/bin/rake"
environment:
PATH: "/Users/snowcrash/.rvm/gems/ruby-2.1.5/bin:/Users/snowcrash/.apportable/SDK/bin:/Library/Frameworks/Python.framework/Versions/2.6/bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/bin:/Users/snowcrash/Library/ec2-api-tools-1.3-24159/bin:/Users/snowcrash/bin:/Users/snowcrash/Library/android-sdk-mac_86:/Users/snowcrash/Library/android-sdk-mac_86/platform-tools:/Users/snowcrash/Library/bin:/usr/local/mysql/bin:/usr/local/bin:/Library/PostgreSQL/9.1/bin:/usr/local/sbin:/Users/snowcrash/.rvm/gems/ruby-2.1.5/bin:/Users/snowcrash/.rvm/gems/ruby-2.1.5#global/bin:/Users/snowcrash/.rvm/rubies/ruby-2.1.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/snowcrash/.rvm/bin:/Users/snowcrash/bin/gsutil:/usr/local/graphviz-2.14/bin:/Users/snowcrash/.rvm/bin"
GEM_HOME: "/Users/snowcrash/.rvm/gems/ruby-2.1.5"
GEM_PATH: "/Users/snowcrash/.rvm/gems/ruby-2.1.5:/Users/snowcrash/.rvm/gems/ruby-2.1.5#global"
MY_RUBY_HOME: "/Users/snowcrash/.rvm/rubies/ruby-2.1.5"
IRBRC: "/Users/snowcrash/.rvm/rubies/ruby-2.1.5/.irbrc"
RUBYOPT: ""
gemset: ""
Your PATH contains /usr/bin multiple times, the first of which is before /Users/snowcrash/.rvm/rubies/ruby-2.1.5/bin, so the system provided ruby is added first.
You seem to have a lot of entries in there - review your shells initialisation files (.bashrc, .bash_profile etc) and check anything that manipulates $PATH
What does stuff like rvm use, which rvm or which ruby say? That looks like the system Ruby, which to me means you don't have rvm properly installed and you opened a new terminal session and got the system version.
Or, the command was entered wrong. rvm use --default 2.1.5
After that, rvm list will show it marked as default.
(nick#blerp)-(~)
(507)⚡️ rvm use --default 2.2.0
Using /Users/nick/.rvm/gems/ruby-2.2.0
(nick#blerp)-(~)
(508)⚡️ rvm list
rvm rubies
=* ruby-2.2.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
You could always reinstall rvm (doesn't hurt to reinstall on top) and make sure the path settings are in your shell dotfiles.
After installing rvm and modifying my .zshrc file when running rvm info i get a different version that when i type ruby -v and when trying to install a gem i get a bunch of errors relating to the system ruby
rvm info output:
$ rvm info
ruby-2.1.1:
system:
uname: "Darwin Joshs-MacBook-Pro.local 13.1.0 Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64"
system: "osx/10.9/x86_64"
bash: "/bin/bash => GNU bash, version 3.2.51(1)-release (x86_64-apple-darwin13)"
zsh: "/bin/zsh => zsh 5.0.2 (x86_64-apple-darwin13.0)"
rvm:
version: "rvm 1.25.20 (stable) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "3 hours 4 minutes 13 seconds ago"
path: "/Users/joshburns/.rvm"
ruby:
interpreter: "ruby"
version: "2.0.0p247"
date: "2013-06-27"
platform: "universal.x86_64-darwin13"
patchlevel: "2013-06-27 revision 41674"
full_version: "ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]"
homes:
ZSH=$HOME/.oh-my-zsh
gem: "/Users/joshburns/.rvm/gems/ruby-2.1.1"
ruby: "/Users/joshburns/.rvm/rubies/ruby-2.1.1"
binaries:
ruby: "/usr/bin/ruby"
irb: "/usr/bin/irb"
gem: "/usr/bin/gem"
rake: "/Users/joshburns/.rvm/gems/ruby-2.1.1/bin/rake"
environment:
PATH: "/Users/joshburns/.rvm/gems/ruby-2.1.1/bin:/Users/joshburns/.rvm/gems/ruby-2.1.1#global/bin:/Users/joshburns/.rvm/rubies/ruby-2.1.1/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/joshburns/bin:/Users/joshburns/.rvm/bin"
GEM_HOME: "/Users/joshburns/.rvm/gems/ruby-2.1.1"
GEM_PATH: "/Users/joshburns/.rvm/gems/ruby-2.1.1:/Users/joshburns/.rvm/gems/ruby-2.1.1#global"
MY_RUBY_HOME: "/Users/joshburns/.rvm/rubies/ruby-2.1.1"
IRBRC: "/Users/joshburns/.rvm/rubies/ruby-2.1.1/.irbrc"
RUBYOPT: ""
gemset: ""
ruby -v output:
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
I think I have had a similar problem but found the solution here:
http://www.intelligentbee.com/blog/2013/09/17/setup-a-simple-ruby-2-on-rails-4-environment-with-vagrant-and-virtual-box/
Look for the bit:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
rvm use ruby-2.0.0-p247 (replace with your ruby version)
when I try to use ruby with the terminal, nothing happens.
The last days I've used it and everything worked but it doesn't anymore.
I installed rvm and the 1.9.3 version of ruby.
It works when I launch a script with ruby myscript.rb, and I tried installing rails but when I type gem install rails I get an error:
/Users/romainberger/.rvm/rubies/ruby-1.9.3-p194/bin/gem:4: warning: Insecure world writable dir /Users/romainberger/.rvm/gems/ruby-1.9.3-p194 in PATH, mode 040777
As there is no output I don't know where the problem comes from. Does anybody have an idea?
Thanks
EDIT:
rvm info
ruby-1.9.3-p194:
system:
uname: "Darwin romain.home 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)"
zsh: "/bin/zsh => zsh 4.3.11 (i386-apple-darwin11.0)"
rvm:
version: "rvm 1.14.1 (master) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "1 day 11 hours 59 minutes 3 seconds ago"
ruby:
interpreter: "ruby"
version: "1.9.3p194"
date: "2012-04-20"
platform: "x86_64-darwin11.3.0"
patchlevel: "2012-04-20 revision 35410"
full_version: "ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.3.0]"
homes:
gem: "/Users/romainberger/.rvm/gems/ruby-1.9.3-p194"
ruby: "/Users/romainberger/.rvm/rubies/ruby-1.9.3-p194"
binaries:
ruby: "/Users/romainberger/.rvm/rubies/ruby-1.9.3-p194/bin/ruby"
irb: "/Users/romainberger/.rvm/rubies/ruby-1.9.3-p194/bin/irb"
gem: "/Users/romainberger/.rvm/rubies/ruby-1.9.3-p194/bin/gem"
rake: "/Users/romainberger/.rvm/gems/ruby-1.9.3-p194#global/bin/rake"
environment:
PATH: "/Users/romainberger/.rvm/gems/ruby-1.9.3-p194/bin:/Users/romainberger/.rvm/gems/ruby-1.9.3-p194#global/bin:/Users/romainberger/.rvm/rubies/ruby-1.9.3-p194/bin:/Users/romainberger/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin"
GEM_HOME: "/Users/romainberger/.rvm/gems/ruby-1.9.3-p194"
GEM_PATH: "/Users/romainberger/.rvm/gems/ruby-1.9.3-p194:/Users/romainberger/.rvm/gems/ruby-1.9.3-p194#global"
MY_RUBY_HOME: "/Users/romainberger/.rvm/rubies/ruby-1.9.3-p194"
IRBRC: "/Users/romainberger/.rvm/rubies/ruby-1.9.3-p194/.irbrc"
RUBYOPT: ""
gemset: ""
gem info gives me:
ERROR: While executing gem ... (RuntimeError)
Unknown command info
And to launch ruby I just type ruby
To fix the gem warning use:
chmod -R go-w /Users/romainberger/.rvm/
It will recursively remove write right for group and others (keeps write for user).
You can check for RVM related resurces on RVM site: https://rvm.io/
I dont understand why after the rvm command I am still on ruby 1.8.7. Ive followed the install instructions for rvm and it all seemed to go fine - where do I look to start resolving this?
andrew#unifex:~$ rvm use 1.9.2 --default
Using /home/andrew/.rvm/gems/ruby-1.9.2-p290
andrew#unifex:~$ ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
andrew#unifex:~$
andrew#unifex:~$ rvm info
ruby-1.9.2-p290:
system:
uname: "Linux unifex 2.6.22-3-amd64 #1 SMP Sun Nov 4 18:18:09 UTC 2007 x86_64 GNU/Linux"
bash: "/bin/bash => GNU bash, version 3.1.17(1)-release (x86_64-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.9.2 by Wayne E. Seguin (wayneeseguin#gmail.com) [https://rvm.beginrescueend.com/]"
ruby:
interpreter: "ruby"
version: "1.9.2p290"
date: "2011-07-09"
platform: "x86_64-linux"
patchlevel: "2011-07-09 revision 32553"
full_version: "ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]"
homes:
gem: "/home/andrew/.rvm/gems/ruby-1.9.2-p290"
ruby: "/home/andrew/.rvm/rubies/ruby-1.9.2-p290"
binaries:
ruby: "/home/andrew/.rvm/rubies/ruby-1.9.2-p290/bin/ruby"
irb: "/home/andrew/.rvm/rubies/ruby-1.9.2-p290/bin/irb"
gem: "/home/andrew/.rvm/rubies/ruby-1.9.2-p290/bin/gem"
rake: "/home/andrew/.rvm/gems/ruby-1.9.2-p290/bin/rake"
environment:
PATH: "/home/andrew/.rvm/gems/ruby-1.9.2-p290/bin:/home/andrew/.rvm/gems/ruby-1.9.2-p290#global/bin:/home/andrew/.rvm/rubies/ruby-1.9.2-p290/bin:/home/andrew/.rvm/bin:/usr/local/java/jdk1.6.0_20/bin:/usr/local/apache/maven/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/local/java/jdk1.6.0_03/bin"
GEM_HOME: "/home/andrew/.rvm/gems/ruby-1.9.2-p290"
GEM_PATH: "/home/andrew/.rvm/gems/ruby-1.9.2-p290:/home/andrew/.rvm/gems/ruby-1.9.2-p290#global"
MY_RUBY_HOME: "/home/andrew/.rvm/rubies/ruby-1.9.2-p290"
IRBRC: "/home/andrew/.rvm/rubies/ruby-1.9.2-p290/.irbrc"
RUBYOPT: ""
gemset: ""
I had this exact problem. It's down to your $PATH not being correct - /usr/bin/ruby is found before rvm gets a chance to do its thing.
In your ~/.bash_profile (As in /Users/andrew/.bash_profile) ensure you have this line present at the bottom of the file:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Then open a new shell
rvm reload
rvm use 1.9.2 --default
ruby -v
You should now have the correct version displayed.