DevHeads.net

RVM PATH & Version Confusion

Hi folks.

Can someone show me how to properly set up my RVM path? I keep getting this while RVM seems to be set up properly. I’m pointing to 2.2.1 yet it barfs on 2.0.0 for some reason:

Warning! PATH is not properly set up, '/Users/rich/.rvm/gems/ruby-2.2.1/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-2.2.1’.

I’ve done that and the last line in my .bash_profile is this:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm”

In fact I only have 2.2.1 installed, so I have no clue why it’s looking for 2.0.0:

HQ:rubies rich$ gem update
/Users/rich/.rvm/gems/ruby-2.2.1/gems/psych-2.0.13/lib/psych.bundle: [BUG] Segmentation fault
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]

Any help appreciated.

Cheers

Comments

Re: RVM PATH & Version Confusion

By Eric MSP Veith at 03/27/2015 - 13:23

On Friday 27 March 2015 13:16:52, Bee.Lists <bee. ... at gmail dot com> wrote:
Does ~/.rvm/scripts/rvm exist?

If yes: Is there anything else that is executed after your ~/.bash_profile has
been sourced, e.g., in ~/.bashrc?

Because, I guess, your system ruby (v2.0.0) is actually used (see: ruby --
version), and I would further guess that it is because it is picked up before
your RVM-installed ruby.

Could you please provide the output of `echo $PATH' and `which ruby'?

--- Eric

Re: RVM PATH & Version Confusion

By Bee.Lists at 03/27/2015 - 13:38

Thanks for the reply.

~/.rvm/scripts/rvm does indeed exist.

~/.bashrc has the single command:

export PATH="$PATH:$HOME/.rvm/bin”

ruby —version => ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]

Here is $PATH:

/Users/rich/.rvm/gems/ruby-2.2.1/bin:/Users/rich/.rvm/gems/ruby-2.2.1@global/bin:/Users/rich/.rvm/rubies/ruby-2.2.1/bin:/Users/rich/.rvm/bin:~/.rvm:/Applications/RF\ Utilities:/Applications/RF\ Utilities/GPSBabel:/usr/local/bin:/usr/bin:/usr/local/mysql/bin:/usr/local/sbin:/usr/sbin:/usr/X11/bin:/opt/local/bin:/opt/local/sbin:/bin:/sbin:~/.rvm:/Applications/RF\ Utilities:/Applications/RF\ Utilities/GPSBabel:/usr/local/bin:/usr/bin:/usr/local/mysql/bin:/usr/local/sbin:/usr/sbin:/usr/X11/bin:/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/usr/local/git/bin:/usr/local/git/bin

HQ:~ rich$ which ruby
/Users/rich/.rvm/rubies/ruby-2.2.1/bin/ruby

(I’ve since used: rvm use 2.2.1)

Re: RVM PATH & Version Confusion

By Eric MSP Veith at 03/28/2015 - 17:49

Hello,

On Friday 27 March 2015 13:38:22, Bee.Lists <bee. ... at gmail dot com> wrote:
Good.

Hm, that might at least explain the error message. ~/.bashrc and
~/.bash_profile are executed for different shells. See bash(8) and have a look
at "INVOCATION". Also, read this:
<http://unix.stackexchange.com/questions/26676/how-to-check-if-a-shell-is-login-interactive-batch>.

However, after a `rvm use', the compilation should actually succeed. Does
`gem' also belong to the RVM ruby version? `which gem' and `gem --version'
should give hints.

Can you post the compile logs of "gem update"?

Cheers,
Eric

Re: RVM PATH & Version Confusion

By Bee.Lists at 04/09/2015 - 23:13

Sorry about the delay. Some emergencies on this side.

Is this for a login shell?

The /etc/profile file:

There is no ~/.bash_login

The ~/.profile file:

But the login would have read .bash_profile because it takes all my aliases and directives. So when I’m asking for IRB, it shouldn’t be looking at 2.0.0 if rvm is set up properly. The new terminals/logins I get are looking to 2.0.0 for some reason, and I get crash reports indicating it’s looking for 2.0.0, including “gem update”.

Not sure where to go with this.

Cheers

Re: RVM PATH & Version Confusion

By Eric MSP Veith at 04/16/2015 - 11:56

Hey,

On Thursday 09 April 2015 23:13:26, Bee.Lists <bee. ... at gmail dot com> wrote:
hope everything went ok.

Yes, basically:

login shell:: /etc/profile, ~/.bash_profile, ~/.bash_login, ~/.profle
interactive shell:: ~/.bashrc

However, adding the stanza to both ~/.bash_profile *and* ~/.bashrc would do
the trick.

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

It could also be that your terminal does not start bash, but sh, in which case
only ~/.profile would be parsed.

Be careful: If ~/.bash_profile *and* ~/.profile exist, both are readable, and
the shell is started as /bin/bash, only ~/.bash_profile will be read.

You can check what interpreter is being run (/bin/sh or /bin/bash) by looking
at $SHELL.

I'd check all those files and the $SHELL variable just to make sure.

If RVM is loaded correctly, it will set your ruby paths to the default ruby,
whatever that is. You can check that with `rvm list`.

Try also executing `which` on different commands, i.e.

`which ruby`
`which gem`
`which irb`

Perhaps some tool is missing, and thus one from /usr/bin gets picked up.

HTH.

--- Eric