Know what errors lurk in your code? Rollbar detects and alerts you when code breaks in production. Get the stack trace, code, and data to help you d̶e̶b̶u̶g̶ defeat Ruby errors. Learn more.

RubyFlow The Ruby and Rails community linklog


The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

.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)

In zsh, I tried this and is seems to work fine:

if [[ -s .rvmrc ]] ; then source .rvmrc ; fi

Thankfully iTerm doesn’t have this problem?

It works well without any tricks if .rvmrc is trusted.

I did an rvm get head to update to the latest version and it works fine now.

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.

After updating to version 1.6.30, it just worked. No trick needed.

You know that you can turn off that functionality in the Terminal app preferences, right? :)

Yes, but I like it…as long as it plays nice with RVM.

Thanks for this

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in