Installing pip+virtualenv on OSX

No, I am by no stretch of the imagination smart enough to figure this out on my own. Using my superior Google-fu, I located a blog post by Jamie Curle walking me through the process, all the way down to the right commands to use in vi (THANK YOU!) when editing a bash file.

The steps are quite straightforward. I only ran into one issue. Jamie's blog likely will work for 95% of you. However, in my case the last two steps were not working right. Specifically, Jamie instructs us to create a file in our home directory called .bash_login so we can access the mkvirtualenv command directly from the command line. This did not work for me.

Again flexing my Google-fu I discovered there is a hierarchy of config files bash searches for in your home directory when starting up. These, in descending order, include ~/.bash_profile, ~/.bash_login and ~/.profile.

A quick listing of files in my home directory using the command :/ ls -la revealed ~/.bash_profile already existed. Bash was reading this file instead of my newly created ~/.bash_login and never seeing my new command. All I did was add the line Jamie instructs to the ~/.bash_profile file instead, and life is good.

The moral of the story is if you do not have a ~/.bash_profile file, the ~/.bash_login method Jamie discusses will work. However, be careful if you already have a ~/.profile file. Any commands included in the ~/.profile file will be overridden since your new ~/.bash_login file takes precedence over your pre-existing ~/.profile. Quite frankly, if you already have any one of these three files, just add the line Jamie instructs to your existing file so virtualenvwrapper works and you do not break anything.

Have fun!