RVM --default bug - ruby

I set the default ruby as,
rvm --default 1.9.2
when I do ruby -v, I get 'ruby 1.9.1'
when I do which ruby I get .rvm/rubies/1.9.2PathOfRuby
Any idea how to fix this?
When I run a sample program, printing the version of ruby i.e, print RUBY_VERSION it prints 1.9.1 :(

I'm using rvm along with a default ruby of 1.9.2 v0:
Greg:~ greg$ rvm list
rvm rubies
ruby-1.8.7-p302 [ i386 ]
=> ruby-1.9.2-p0 [ i386 ]
Greg:~ greg$ rvm -v
rvm 0.1.46 by Wayne E. Seguin (wayneeseguin#gmail.com) [http://rvm.beginrescueend.com/]
Greg:~ greg$ ruby --version
ruby 1.9.2p0 (2010-08-18 revision 29036) [i386-darwin9.8.0]
Greg:~ greg$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [i386-darwin9.8.0]
I'm not sure what the current version of rvm is, but 0.1.46 seems to be working correctly. You might want to try doing rvm update to get the latest rev if you're running an older version.
Your best solution for rvm help is to go directly to the author, Wayne Seguin, either on the RVM site or on #IRC at irc.freenode.net. The RVM site is http://rvm.beginrescueend.com/.
Wayne's a great guy, very helpful and quick to respond.

Check your PATH statement in .bash_profile (or equivalent). Remove entries that reference gems/ruby-1.9.1-yadda. Restart your terminal and check the version of ruby then. It should report 1.9.2 now, although you might need to rerun rvm 1.9.2 --default again.

Related

Ruby 1.9.3 with rvm on Mac Lion installs, but doesn't show up in Ruby or irb

On Mac OS X running Lion 10.7.3 and having Xcode 4.3.2, I find that installing ruby 1.9.3 through rvm and setting default to use 1.9.3 still shows ruby -v to be 1.8.7 (irb RUBY_VERSION also shows 1.8.7).
$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]
$ rvm install 1.9.3 --with-gcc=clang
<installs successfully>
$ rvm --default 1.9.3
$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]
$ irb
>> RUBY_VERSION
=> "1.8.7"
How do I get ruby and irb to use ruby 1.9.3 on this configuration?
Update: Looks like I had an older version of rvm. I installed Jewelry Box (OS X rvm GUI tool), which reinstalled rvm, and then updated the ruby to use from within jewelry box. This did the trick. Thanks all for your help.
Thanks
If you have successfully installed ruby 1.9.3
then you can check it by this command either installed or not
rvm list
then all rubies listing will be display...
then if you select any rubu version use this command
rvm use ruby-1.9.3 --default
and enjoying.........
rvm get head will update your RVM installation in place to the current release. It's a good idea to do that periodically, just to keep up with the bug fixes and new features.
I had a similar issue and wanted to post my solution as it may be helpful for someone. I switched to 1.9.3 in my terminal window and then opened another window to use IRB in that window. When I did
RUBY_VERSION
in IRB it told me I was using 1.8.7. I realized after that I shouldn't have opened another window to do it. It works just fine if I stay in the same window, make sure I am using 1.9.3 and then go into IRB from there.
Thought someone else might have a use case like mine and this would help.

ruby stuck in 1.8.7 on ubuntu

Today I learned that Ubuntu is bundled with Ruby 1.8.7. I want 1.9.2, but getting Ruby 1.9.2 working has been frustrating.
First, note that Ruby 1.9.2 is already installed on my system.
Here's what's happening:
$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
$ rvm list
rvm rubies
=* ruby-1.9.2-p290 [ x86_64 ]
ruby-1.9.3-p0 [ x86_64 ]
$ printenv PATH
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
$ which ruby
/usr/bin/ruby
$ which rvm
/usr/bin/rvm
RVM hasn't initialized correctly. Your path should show RVM's managed directories first.
Have you added the RVM initializer to your .bash_profile or .bashrc, and have you restarted your shell session or logged out then back in?
Have you followed the installation and troubleshooting directions at http://rvm.beginrescueend.com/rvm/install ?
Please append the output of rvm info to your question.
Normally RVM would install inside your ~/.rvmrc directory for a single-user sandbox. Because it is at /usr/bin/rvm that tells me you installed it as root or did a sudo when you installed it. I highly recommend not bothering with multi-user RVM unless you have a really good reason, and instead use the single-user install.

How do I switch Ruby system back to 1.8.7 using RVM?

If I run:
rvm system
ruby -v
I get:
ruby-192...
I want the system version that is Ruby 1.8.7.
Ruby 1.9.2 was installed using RVM. I still can see Ruby 1.8.7 if I run /usr/bin/ruby -v.
rvm info
system:
system:
uname: "Darwin MacML.local 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~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.10.0 by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.beginrescueend.com/]"
homes:
gem: "not set"
ruby: "not set"
binaries:
ruby: "/usr/local/bin/ruby"
irb: "/usr/local/bin/irb"
gem: "/usr/local/bin/gem"
rake: "/usr/local/bin/rake"
environment:
PATH: "/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/Users/ML/.rvm/bin"
GEM_HOME: ""
GEM_PATH: ""
MY_RUBY_HOME: ""
IRBRC: ""
RUBYOPT: ""
gemset: ""
First, use rvm info and make sure the values reported are sane and what you expect.
As of this moment, RVM is at version 1.10.0. If rvm -v shows a lower version number, run rvm get head;rvm reload to update to the current version. That step alone can fix all sorts of issues.
To switch from a RVM controlled Ruby back to the version installed in your Mac by Apple, use:
rvm system
That should allow you to do:
which ruby
and get:
/usr/bin/ruby
or:
ruby -v
and get something like:
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin10.0]
To return to a RVM controlled Ruby, use: rvm 1.9.2 or rvm default if you have set up a default Ruby.
If you haven't set up a default Ruby, I recommend you do so, using: rvm 1.9.2 --default, substituting whatever version of Ruby you want as your default.
You do NOT have to install a version of 1.8.7 under RVM's control if you don't want to, however, if you intend to modify the 1.8.7 owned by the system by adding or changing gems do so carefully. That version was installed for Apple's use and you are piggybacking on it and changes could affect the use of certain apps or future apps installed by Apple.
If you need to add gems or tweak 1.8.7, I'd recommend using RVM's rvm install 1.8.7 into your sandbox, and go from there. At that point you can eschew using the system version of Ruby 1.8.7, and leave it alone for Apple's apps.
If all you want to do is install MacVIM, you can accomplish what you want, which is to tell the system that the RVM versions are NOT installed, by temporarily tweaking your PATH variable to NOT include the RVM controlled Rubies in your ~/.rvm directory.
You can do that by editing PATH, or by temporarily modifying your ~/.bash_profile or ~/.bashrc, whichever has the RVM initialization in it. Open a new shell, run your install steps, then revert the file.
There are many ways to get where you want to go.
Maybe you should try: rvm use system?! Or rvm use system --default to use system Ruby every time.
First you need to install 1.8.7:
rvm install 1.8.7
Then you need to tell RVM you want to use this one as the default:
rvm use 1.8.7 --default
I'm not sure why the system is not working right for you, but installing 1.8.7 and using it should resolve the compilation error for macvim. Instead of "rvm system", run
rvm install 1.8.7
rvm use 1.8.7
That should resolve it.
The problem were these 2 lines below on my .profile
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
I commented both and the path to the system ruby went back to normal. the Tin Man tip was crucial to find what the problem was.
I had one ruby version in /usr/local/bin/ruby and another in /usr/bin/ruby
After I commented the lines mysql stopped working by I reinstalled with brew and everything seems to be working

How to update my version of Ruby from terminal?

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

Ruby 1.9.2 not installing on OSX?

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.

Resources