Create a gist now

Instantly share code, notes, and snippets.

@fspaolo /macosx.md
Last active Jun 16, 2017

What would you like to do?

Software install on Mac OS X

Install Fonts for Matplotlib (Helvetica)

Download a font converter (no need to install, unzip and launch the GUI):

http://peter.upfold.org.uk/projects/dfontsplitter

Or install Fondu:

http://fondu.sourceforge.net/

Convert Mac fonts .dfont to .ttf (with GUI, select 'Source Fonts'):

/System/Library/Fonts/Helvetica.dfont

Place font files .ttf in Matplotlib data dir (with GUI, select 'Destination Folder', then 'Convert'):

cp *.ttf ~/anaconda2/lib/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf

Edit matplotlibrc (for Mac):

vim ~/.matplotlib/matplotlibrc

font.sans-serif : Helvetica
pdf.fonttype    : 42
backend         : MacOSX

Remove fontList.cache to force update:

rm ~/.matplotlib/fontList.cache

Install XQuartz, OpenMotif and Grace

UPDATE: Install everythign using brew:

brew install Caskroom/cask/xquartz
brew install https://gist.githubusercontent.com/steakknife/60a39a32ae84e12238a2/raw/openmotif.rb
brew install grace

DEPRECATED: use brew instead.

Download and install X11's latest version (XQuartz):

http://xquartz.macosforge.org/trac/wiki/Releases

Download and install OpenMotif:

http://www.ist.co.uk/motif/download/index.html

Add to ~/.bash_profile:

export PATH="/usr/OpenMotif/bin:${PATH}"
export DYLD_LIBRARY_PATH="/usr/OpenMotif/lib"

Download and install Grace (XmGrace):

$ cd Desktop
$ wget ftp://ftp.fu-berlin.de/unix/graphics/grace/src/grace5/grace-latest.tar.gz
$ tar xzvf grace-latest.tar.gz
$ cd grace-5.1.23
$ ./configure --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib \
--with-motif-library=-lXm  --with-extra-incpath=/usr/OpenMotif/include:/Users/sm4082/fftw-2.1.5/include \
--with-extra-ldpath=/usr/OpenMotif/lib:/Users/sm4082/fftw-2.1.5/lib
$ make
$ sudo make install
$ echo "export PATH=$PATH:/usr/local/grace/bin" >> ~/.bash_profile
$ source ~/.bash_profile
$ xmgrace

Install EPD 32-bit and 64-bit concurrently

ETS (e.g., Mayavi, TVTK) is not part of EPD 64-bit on Mac OS X (https://support.enthought.com/entries/23407541-Getting-Started-with-EPD-on-OS-X). This is due to underlying graphics toolkit limitations. The easiest solution is to run a 32-bit Python concurrently.

Download and install the packages:

epd-7.3-2-macosx-i386.dmg    # 32-bit
epd-7.3-2-macosx-x86_64.dmg  # 64-bit

Both installations will edit your ~/.bash_profile. To have the 64-bit version as default, make sure you have commented and uncommented the following (this will depend on the order they were install):

# Setting PATH for EPD-7.3-2 (32-bit)
# The orginal version is saved in .bash_profile.pysave
#PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"
#export PATH
# ...
# Setting PATH for EPD-7.3-2 (64-bit)
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/EPD64.framework/Versions/Current/bin:${PATH}"
export PATH

To be able to run the 32-bit version from the command line, add to ~/.bash_profile:

alias python32=/Library/Frameworks/Python.framework/Versions/Current/bin/python
alias ipython32=/Library/Frameworks/Python.framework/Versions/Current/bin/ipython
$ source ~/.bash_profile

From the command line:

$ python32
Enthought Python Distribution -- www.enthought.com
Version: 7.3-2 (32-bit)

Python 2.7.3 |EPD 7.3-2 (32-bit)| (default, Apr 12 2012, 11:28:34) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "credits", "demo" or "enthought" for more information.
>>> 

$ python
Enthought Python Distribution -- www.enthought.com
Version: 7.3-2 (64-bit)

Python 2.7.3 |EPD 7.3-2 (64-bit)| (default, Apr 12 2012, 11:14:05) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "credits", "demo" or "enthought" for more information.
>>>     

Another alternative would be to set (on the fly) the terminal window to use either 32-bit or 64-bit as default, by adding to ~/.bash_profile:

# prefix dirs for each Enthought Python version:
export EPD32=/Library/Frameworks/Python.framework/Versions/Current/bin
export EPD64=/Library/Frameworks/EPD64.framework/Versions/Current/bin

# Aliases to set PATH for EPD 32 or 64
alias epd32="export PATH=${EPD32}:${PATH}"
alias epd64="export PATH=${EPD64}:${PATH}"

Install GDAL for Python

UPDATE: Now GDAL can be installed simply by doing:

conda install -c conda-forge gdal

or

pip install gdal

Nothing else required!

Download http://www.kyngchaos.com/software:frameworks#gdal_complete

And see /Library/Frameworks/GDAL.framework/Versions/1.8/Resources/gdal.pth to set the PYTHONPATH and PATH (see below).

  1. in ~/.bash_profile:

    GDAL Python

    export PYTHONPATH=/Library/Frameworks/GDAL.framework/Versions/Current/Python/site-packages:$PYTHONPATH

    GDAL Unix/Mac

    export PATH="/Library/Frameworks/GDAL.framework/Versions/Current/unix/bin:${PATH}"

  2. in the terminal:

    $ source ~/.bash_profile

Install gfortran

gfortran for Mac OS X: http://r.research.att.com/tools/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment