The IPython Notebook is a great way to quickly test out some things in Python. On Mac OS X it can be installed in just a few minutes using homebrew.

Install Python 3 with homebrew

First of all we will install homebrew. homebrew is a package manager for OS X which streamlines software installation via command line. To install homebrew follow the instructions on the official site. In most cases you should be fine running the following command in a terminal:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

That’s it. You now can use the brew command to install Python 3.

brew install python3

IPython Notebook has a dependecy to ZeroMQ. We can also install it with homebrew.

brew install zeromq

Install IPython Notebook

As you might already have noticed I use a Python version 3. Python 3 brings the ability to install and isolate all installed packages in virtual environments. Since this is a great way to keep your system clean, we will also install IPython inside its own virtual environment. So lets create a new virutal environment:

cd ~
pyvenv IPython
source IPython/bin/activate

To check whether the new virtual environment is up and running you can type the following command:

which pip

This should show something like ~/IPython/bin/pip.

Now we are ready to install the IPython Notebook.

pip install ipython[notebook]

Thats it! Each time we want to use the IPython Notebook, we just need to type the following two command:

source ~/IPython/bin/activate
ipython notebook

As you might already have guessed, the first one will enable the virtual environment with our IPython installation. The second command start the IPython Notebook server itself.

Pretty simple huh?