Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OSX Lion New bash session rvm default ruby not used

I use OSX Lion. I have installed RVM and have put this line in my .bash_profile file.

[[ -s "/Users/Anand/.rvm/scripts/rvm" ]] && source "/Users/Anand/.rvm/scripts/rvm"  # This loads RVM into a shell session.

I installed ruby-1.9.2-p290 and set it as default rvm ruby with this command:

rvm use --default ruby-1.9.2-p290

And when I checked ruby-v

ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.2.0]

The problem is, every time I open a new terminal window or a tab, the default ruby is not getting set. The system ruby is instead getting used. ruby -v gives this:

ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.3.2]

This also happens with reading .rvmrc file in a ruby project. When I'm inside a project and when a new tab gets opened, it gets me into the project directory but is not setting ruby according to .rvmrc in that project. What should I do to fix this?

like image 834
Anand Avatar asked Jan 15 '12 18:01

Anand


1 Answers

I got the problem. It was with $PATH. I have to put rvm related line in the .bash_profile as the last line.

Old .bash_profile

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

source $HOME/Dropbox/dotfiles/bashrc
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
export PATH=/Library/PostgreSQL/9.0/bin:$PATH

New .bash_profile

source $HOME/Dropbox/dotfiles/bashrc
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
export PATH=/Library/PostgreSQL/9.0/bin:$PATH

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

And it worked. New windows and new tabs open up correctly with the default ruby i.e, ruby 1.9.2

like image 179
Anand Avatar answered Oct 24 '22 08:10

Anand