strangerpixel
strangerpixel

Reputation: 828

Ruby versions differ in Terminal & bash

In Terminal, ruby -v gives me:

ruby 1.8.7 (2011-12-28 patchlevel 357) [universal-darwin11.0]

But if I type /bin/bash then ruby -v I get:

ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]

I suspect this is something to do with my PATH config(s). My $PATH variable is different in both the above environments. There are other issues e.g. rvm won't run unless I go into bash mode.

For info, my ~/.bashrc contains:

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"  # This loads RVM into a shell session.

Upvotes: 2

Views: 3383

Answers (3)

strangerpixel
strangerpixel

Reputation: 828

This was not due to a $PATH problem. What I've learned is that RVM cannot be run unless you change your default login shell to either Bash or ZSH. Just firing up Terminal in Mac won't work. You make the global change to using Bash like this:

chsh -s /bin/bash

(swap /bin/bash for whatever your bash path is, find out using which bash).

The RVM website does say that bash>=3.2.25 is a prerequisite, but doesn't say what that is or how to check whether you have it. It also advises you to run rvm requirements to check what you need - and you can't run this unless you change your shell (all quite confusing for somebody new to this).

Thanks to the replies above for getting me there in the end.

See also: Bad: modifier error when installing RVM

Upvotes: 0

the Tin Man
the Tin Man

Reputation: 160551

Try which ruby from "terminal" and "/bin/bash". Your 1.9.3 is inside your ~/.rvm path.

Type rvm info. You should get a list of the settings for RVM.

In your ~/.bashrc OR ~/.bash_profile, you should have RVM's initialization code. If you don't you didn't install RVM completely and need to finish. Read all the instructions on the RVM installation page.

Upvotes: 1

mpapis
mpapis

Reputation: 53158

Looks like "login shell" is not enabled, you need to enable it in Terminal Emulator Preferences, sometimes it is needed to use /bin/bash --login.

There are also known issues with ZSH, but it seams to be unrelated.

Upvotes: 1

Related Questions