RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  

.rvmrc and Terminal in OSX Lion

In OSX Lion, Terminal now defaults new tabs to open in the same working directory you were just in. That's nice, but your .rvmrc file will not get executed. That's because RVM only executes it when you `cd` into that directory, and opening a new session in that directory doesn't count. Here's a fix. Add this to your ~/.bash_profile or whatever you use: cd . Whenever you open a new terminal session, this will automatically cd into the current directory, triggering RVM to execute the .rvmrc. This seems like a quick and dirty trick, so if anybody knows a better way, please comment.


Here's what I've verified: when the .rvmrc file is trusted, a new tab will trigger it normally.

When the file is new, it won't be triggered (rvm will not ask you to trust it). But the "cd ." trick also doesn't solve it.

I'm using rvm head and OS X Lion (10.7)lucashungaro - July 25, 2011 16:42
In zsh, I tried this and is seems to work fine:

if [[ -s .rvmrc ]] ; then source .rvmrc ; fiJake - July 25, 2011 16:44
Thankfully iTerm doesn't have this problem?Joe - July 25, 2011 17:06
It works well without any tricks if .rvmrc is trusted.Spectator - July 25, 2011 17:27
I did an rvm get head to update to the latest version and it works fine now.Kenzie - July 25, 2011 18:02
You could also use my direnv project :

It's just a shell wrapper to load environments depending on your current path, and integrates with rvm.zimbatm - July 25, 2011 21:05
After updating to version 1.6.30, it just worked. No trick needed.ningja - July 26, 2011 03:38
You know that you can turn off that functionality in the Terminal app preferences, right? :)Tanel Suurhans - July 26, 2011 06:44
Yes, but I like long as it plays nice with RVM.ningja - July 28, 2011 00:58
Thanks for thisDarcy - September 10, 2011 15:55

Post a Comment

Comment abilities for non registered users are currently deactivated, pending time to add a proper CAPTCHA to solve the escalating spam problem. Sorry!