Install Ruby gems into virtualenv

You are a Python developer and every time you have to install a Ruby gem you throw up in your mouth a little. Wouldn’t it be nice if you could install Ruby gems into your virtualenv? Yeah, it would.

Stick this in your virtualenv’s postactivate script:

export GEM_HOME="$VIRTUAL_ENV/gems"
export GEM_PATH=""
export PATH=$PATH:"$GEM_HOME/bin"

That’s it! You’re welcome. :)


Give credit where credit is due. I stole this idea from Idan Gazit and made it better.

This article was first published on June 10, 2011. As you can see, there are no comments. I invite you to email me with your comments, criticisms, and other suggestions. Even better, write your own article as a response. Blogging is awesome.