Setting up a Python Scientific Environment (NumPy, SciPy, pandas, StatsModels, etc.) in OS X 10.9 Mavericks

It is better than a nightmare from which you cannot wake up …

  1. Install Homebrew:

    $ ruby -e "$(curl -fsSL"
  2. Find problems and fix them (typically resulting from Homebrew becoming very stroppy if it does not have exclusive access to “/usr/local“):

    $ brew doctor

    VERY IMPORTANT NOTE: Make ABSOLUTELY sure that the DYLD_LIBRARY_PATH environmental variable is NOT set. Having this set will cause all sorts of problems as conflicts arise between libraries that homebrew installs that some of your other packages need (e.g., "libpng" and MacVim, respectively). Worse, some builds get confused and fail (e.g., “matplotlib“). What happens if you need DYLD_LIBRARY_PATH for other applications? Please direct your questions to the homebrew folks.

  3. Install Homebrew’s Pythons:

    $ brew install python
    $ brew install python3
  4. Either create and source a virtual environment using Homebrew’s Python:

    $ virtualenv -p /usr/local/python3 homebrew-stats-computing
    $ . homebrew-stats-computing/bin/activate

    Or make sure Homebrew’s Python is at the head of the “$PATH“:

    $ export PATH=/usr/local/bin:$PATH
  5. Install The NumPy + SciPy + pandas stack:

    $ brew install gfortran
    $ pip3 install numpy
    $ pip3 install scipy
    $ pip3 install pandas
  6. Install StatsModels:

    $ pip3 install cython
    $ pip3 install patsy
    $ cd /tmp
    $ git clone
    $ cd statsmodels
    $ python3 build
    $ python3 install
  7. Install matplotlib:

    $ brew install libpng freetype pkgconfig
    $ cd /tmp
    $ git clone
    $ cd matplotlib
    $ python3 install

Taking it to a 11: Dramatically Speeding Up Keyboard/Typing Responsiveness in OSX

If you use a Mac/OSX, then enter the following commands in your shell and reboot:

    $ defaults write -g KeyRepeat -int 0
    $ defaults write -g InitialKeyRepeat -int 15

If you live in a text editor or the shell, or otherwise spend most of your typing hammering away at the keyboard like I do,
then this makes an absolutely wonderful difference in the responsiveness of any typing activity. It will make your previous typing feel like you were pecking away in slow motion at the bottom of a pit of cold tar!

Yes, I know you can set the keyboard repeat rate in `System Preferences`.

I, too, did that a long time ago.

But this trick takes the speed to a 11