Getting Started on a Mac

In this post I’ll talk about how to set up your Scipy stack on a Mac, and make some recommendations for other tools: Homebrew for general package management, iTerm2 for a terminal, Solarized for a text editing color scheme, and pathogen for vim package management.

The SciPy Stack

Python is preinstalled on a Mac, but you’ll still probably want the SciPy stack. Chris Fonnesbeck has a great shell script called the Scipy Superpack on GitHub. The README will link to a page of code that you can copy, paste, save as install_superpack.sh and then run at the command prompt as,

sh install_superpack.sh

At this point it is also a good idea to install pip, the Python package manager.

sudo easy_install pip

R

If you like R (which you should) then you can get it here. You’ll also want RStudio, which is available here.

Homebrew

The next is Homebrew, a package manager for OSX. I used it to install git and it came off without a hitch.

iTerm2 and Solarized

I also recommend iTerm2, which allows you to split your terminal into panes and do other fun things. I didn’t like the available color schemes, so I installed Ethan Schoonover’s Solarized color scheme, which is a beautiful, lower contrast palette. For vim, I followed the instructions here and used Tim Pope’s pathogen tool for package and plugin management in vim. You can download the solarized color scheme, among others, for iTerm2 here.

Here is what I did to install pathogen, taken from the link above:

mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim

Here is what I did to install the solarized color scheme, also taken from the link above. This assumes that you’ve installed git using home-brew, or some other tool.

cd ~/.vim/bundle
git clone git://github.com/altercation/vim-colors-solarized.git

Here is my .vimrc file:

execute pathogen#infect()

" syntax highlighting
syntax enable
set background=light
let g:solarized_termcolors=256
colorscheme solarized

" tab settings
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab

" add linenumbers
set number

Errata

I noticed sometimes that after I installed things with pip, that ipython would not be able to find things in /usr/local/lib/python2.7/site-packages, because it was not in sys.path, but the regular Python interpreter found these packages just fine. I tried editing /etc/launchd.conf, but that didn’t help. I ended up adding the following two lines to .bash_profile:

PYTHONPATH="$PYTHONPATH:/usr/local/lib/python2.7/site-packages"
export PYTHONPATH