How to make 1.9.2 my default version using RVM

Hi,

I know this may not be the right place to ask questions about RVM but I
couldn’t find a better forum.

I have installed RVM as well as ruby 1.9.2 and everything works just
fine except I cannot make ruby 1.9.2 my default.

This is what I did…
1-installed RVM
2-installed new versions of ruby (1.9.2)
3-typed rvm use ruby 1.9.2

and everything works fine, if I type “ruby -v” I get something like
“ruby 1.9.2p290…” which is fine, the problem is that I cannot set this
version to be my default, I tried “rvm --default use ruby 1.9.2” but if
I close and restart Terminal and type “ruby -v” it goes back to the
system default ruby version 1.8.7.

Any idea am I missing why its not working?

Is there any other way to make 1.9.2 my default, so I don’t have to
specify what version of ruby I want to use every time I open a new
Terminal window?

Thanks a lot!

Fily S. писал 24.11.2011 20:14:

1-installed RVM

Any idea am I missing why its not working?

Is there any other way to make 1.9.2 my default, so I don’t have to
specify what version of ruby I want to use every time I open a new
Terminal window?

Thanks a lot!

The ordering of arguments is screwed up a bit in rvm.

$ rvm use 1.9.2 --default

Thanks for your help.

I tried what you suggested “rvm use 1.9.2 --default” and it does work
but if I close terminal and open it agin it goes back to 1.8.7.

Any other suggestion?

Thanks a lot

Hi

You may create file .rvmrc in your project directory
with such content:

“rvm use 1.9.2”
or with gemset
“rvm use 1.9.2@my_project_gemset”

В Птн, 25/11/2011 в 01:31 +0900, Fily S. пишет:

On Thu, Nov 24, 2011 at 8:31 AM, Fily S. [email protected]
wrote:

I tried what you suggested “rvm use 1.9.2 --default” and it does work
but if I close terminal and open it agin it goes back to 1.8.7.

If it “goes back” to the system Ruby, you’re not invoking rvm at all.

Re-read the rvm installation guide and make sure you’ve configured
your .bash_profile properly.

On Thu, Nov 24, 2011 at 9:10 AM, Fily S. [email protected]
wrote:

You may create file .rvmrc in your project directory

Excuse my ignorance but where should I create this file? Sorry.

Any directory you want; when you cd into it, it’ll be invoked.

If it “goes back” to the system Ruby, you’re not invoking rvm at all.

Re-read the rvm installation guide and make sure you’ve configured
your .bash_profile properly.
This is what i currently have in my .bash_profile
[[ -s “$HOME/.rvm/scripts/rvm” ]] && source “$HOME/.rvm/scripts/rvm”

Yes, but does it work? Do you get the expected output from the test?

08:34 ~ $ type rvm | head -1
rvm is a function
09:16 ~ $

What is the result of rvm info in a freshly opened Terminal window ?

Artem Melnikov wrote in post #1033575:

Hi

You may create file .rvmrc in your project directory
with such content:

“rvm use 1.9.2”
or with gemset
“rvm use 1.9.2@my_project_gemset”

Excuse my ignorance but where should I create this file? Sorry.

If it “goes back” to the system Ruby, you’re not invoking rvm at all.

Re-read the rvm installation guide and make sure you’ve configured
your .bash_profile properly.
This is what i currently have in my .bash_profile
[[ -s “$HOME/.rvm/scripts/rvm” ]] && source “$HOME/.rvm/scripts/rvm” #
This loads RVM into a shell session.

Is there something else that need to be added?

Thanks a lot for your help

On Thu, Nov 24, 2011 at 11:02 AM, Fily S. [email protected]
wrote:

Yes, but does it work?
Well no, it goes back to the system default

Do you get the expected output from the test?
What test?

Uh, the one on the RVM installation instructions page that I suggested
you re-read (and then quoted in my reply):

08:34 ~ $ type rvm | head -1
rvm is a function
09:16 ~ $

You could also answer this question from the previous reply:

Yes, but does it work?
Well no, it goes back to the system default

Do you get the expected output from the test?
What test?

Thank you for your help!

Oh, sorry about the missunderstanding.

When I type “type rvm | head -1” it returns “rvm is a function”

is the how it should?

On Thu, Nov 24, 2011 at 11:30 AM, Fily S. [email protected]
wrote:

Oh, sorry about the missunderstanding.

When I type “type rvm | head -1” it returns “rvm is a function”

and

What is the result of rvm info in a freshly opened Terminal window?

If you don’t read emails in their entirety, it’s going to take a lot
longer
to get the the solution…

What is the result of rvm info in a freshly opened Terminal window?

This is what I get

ruby-1.9.2-p290:

system:
uname: “Darwin lapMac 11.2.0 Darwin Kernel Version 11.2.0: Tue
Aug 9 20:56:15 PDT 2011; root:xnu-1699.24.8~1/RELEASE_I386 i386”
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.9.1 by Wayne E. Seguin ([email protected])
[https://rvm.beginrescueend.com/]”

ruby:
interpreter: “ruby”
version: “1.8.7”
date: “2011-02-18”
platform: “i686-darwin10”
patchlevel: “2011-02-18 patchlevel 334”
full_version: “ruby 1.8.7 (2011-02-18 patchlevel 334)
[i686-darwin10]”

and a lot more…

Is there any specific line of code that we are looking for, do you want
me to copy
the whole thing?

Thank you for your patient.

On 24/11/11 20:15, “Fily S.” [email protected] wrote:

Is there any specific line we are looking for, do you want me to copy
the whole thing?

Uh, yeah. Copy the whole output, then post it…

Cheers,

Phil...

ruby-1.9.2-p290:

system:
uname: “Darwin lapMac 11.2.0 Darwin Kernel Version 11.2.0: Tue
Aug 9 20:56:15 PDT 2011; root:xnu-1699.24.8~1/RELEASE_I386 i386”
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.9.1 by Wayne E. Seguin ([email protected])
[https://rvm.beginrescueend.com/]”

ruby:
interpreter: “ruby”
version: “1.8.7”
date: “2011-02-18”
platform: “i686-darwin10”
patchlevel: “2011-02-18 patchlevel 334”
full_version: “ruby 1.8.7 (2011-02-18 patchlevel 334)
[i686-darwin10]”

homes:
gem: “/Users/useName/.rvm/gems/ruby-1.9.2-p290”
ruby: “/Users/useName/.rvm/rubies/ruby-1.9.2-p290”

binaries:
ruby: “/opt/local/bin/ruby”
irb: “/opt/local/bin/irb”
gem: “/Users/useName/.rvm/rubies/ruby-1.9.2-p290/bin/gem”
rake: “/Users/useName/.rvm/gems/ruby-1.9.2-p290/bin/rake”

environment:
PATH:
“/opt/local/bin:/opt/local/sbin:/Users/useName/.rvm/gems/ruby-1.9.2-p290/bin:/Users/useName/.rvm/gems/ruby-1.9.2-p290@global/bin:/Users/useName/.rvm/rubies/ruby-1.9.2-p290/bin:/Users/useName/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin”
GEM_HOME: “/Users/useName/.rvm/gems/ruby-1.9.2-p290”
GEM_PATH:
“/Users/useName/.rvm/gems/ruby-1.9.2-p290:/Users/useName/.rvm/gems/ruby-1.9.2-p290@global”
MY_RUBY_HOME: “/Users/useName/.rvm/rubies/ruby-1.9.2-p290”
IRBRC: “/Users/useName/.rvm/rubies/ruby-1.9.2-p290/.irbrc”
RUBYOPT: “”
gemset: “”

Thanks a lot

On Thu, Nov 24, 2011 at 12:24 PM, Fily S. [email protected]
wrote:

binaries:
ruby: “/opt/local/bin/ruby”
irb: “/opt/local/bin/irb”

Did you previously install a version of Ruby using MacPorts or Brew
or something? The built-in Apple Ruby shows up as:

binaries:
ruby: “/usr/bin/ruby”
irb: “/usr/bin/irb”
gem: “/usr/bin/gem”
rake: “/usr/bin/rake”

However that /opt/local junk got there, you need to get rid of it…

On 24/11/11 20:24, “Fily S.” [email protected] wrote:

ruby-1.9.2-p290:

system:
uname: “Darwin lapMac 11.2.0 Darwin Kernel Version 11.2.0: Tue
Aug 9 20:56:15 PDT 2011; root:xnu-1699.24.8~1/RELEASE_I386 i386”
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)”

[snip]

So your using MacPort’s ruby in /opt/local/bin/ruby It’s usually the
other
way 'round with MacPorts, no matter what you try you can’t get to switch
versions of an interpreter if MP has installed one.

Try putting this in your .bash_profile

export PATH=$PATH:/opt/local/bin/ruby

Cheers,

Phil...

On 24/11/11 20:38, “Hassan S.” [email protected]
wrote:

Did you previously install a version of Ruby using MacPorts or Brew
or something? The built-in Apple Ruby shows up as:

binaries:
ruby: “/usr/bin/ruby”
irb: “/usr/bin/irb”
gem: “/usr/bin/gem”
rake: “/usr/bin/rake”

However that /opt/local junk got there, you need to get rid of it…

If you do decide to rm the MacPorts Ruby you’ll need to do this:

$ sudo port uninstall --follow-dependents ruby19

which will remove the gems associated with that version of Ruby
otherwise it
won’t let you uninstall ruby19.

Cheers,

Phil...

On Thu, Nov 24, 2011 at 12:15 PM, Fily S. [email protected]
wrote:

What is the result of rvm info in a freshly opened Terminal window?

ruby-1.9.2-p290:

Is there any specific line we are looking for, do you want me to copy
the whole thing?

That would have been the obvious response, but in any case – this
appears to show you are using rvm’s ruby 1.9.2; why did you think
you’re not?

First of all thank you all for your help!
The biggest problem is that I dont fully understand what MacPorts are or
how they work, I know I installed it because I needed to install
FoxRuby and its what the book (FoxRuby book) suggested to do. When
someone starts talking about installing something using
MacPorts, or Git I start sweeting (i know i need to work more on the
terminal).

Since it looks like I have some sort of mass, before I proceed I would
like to have a better understanding about the following.
1-What MacPorts are and how they work?
2-What would you guys do, unistall MacPorts than uninstall and reinstall
RVM?

Thanks a lot for your patient

On 24/11/11 21:59, “Fily S.” [email protected] wrote:

2-What would you guys do, unistall MacPorts than uninstall and reinstall
RVM?

MacPorts is like a superior version of Fink. It’s a package manager for
installing open source software that grabs the tar ball for you,
compiles it
& installs it into /opt/local. /opt/local, like /usr/local, are
preferred
destinations for User installs as they a.) don’t mess with the System
software & b.) won’t get overwritten by any OS updates.

I’d be tempted to just uninstall ruby19 the description of which I
posted
earlier & if you used MacPorts to install rvm, uninstall that too
(you’ll
have to Google the vagaries on that particular one though). I wouldn’t
bother uninstalling MacPorts however. You may need it later on for other
projects.

The System Ruby, unlike the System perl, is fine to use for development
(OS
X relies heavily on perl & Apple has tweaked the configure on the OS
version), same goes for the System Python. That’s OK to use too.

If, however, you installed rvm directly from its site there’s no need to
mess with it. I suggest you spend an hour at the rvm site until you know
exactly what it does.

Cheers,

Phil...