Install PyMOL on Mac OS X Snow Leopard

November 02, 2011

Installing free PyMOL on Mac isn't as easy as installing on Windows or Linux. For one thing, there is no precompiled binary (although you can buy one from Schrodinger). The tutorial shows how to install the free version of PyMOL using MacPorts (background).

Another problem is that compiling from source leads to compile errors, and these errors depend on the version of Python you're running. With Python 2.7 and PyMOL 1.4.1, this is what I saw:

$ pymol setup.py build
[snip]
layer0/ShaderMgr.c: In function ‘ShaderMgrConfig’:
layer0/ShaderMgr.c:173: error: ‘GLEW_OK’ undeclared (first use in this function)
layer0/ShaderMgr.c:173: error: (Each undeclared identifier is reported only once
layer0/ShaderMgr.c:173: error: for each function it appears in.)
layer0/ShaderMgr.c:174: error: ‘GLEW_VERSION_2_0’ undeclared (first use in this function)
layer0/ShaderMgr.c:185: warning: format ‘%s’ expects type ‘char *’, but argument 3 has type ‘int’
layer0/ShaderMgr.c: In function ‘ShaderMgrConfig’:
layer0/ShaderMgr.c:173: error: ‘GLEW_OK’ undeclared (first use in this function)
layer0/ShaderMgr.c:173: error: (Each undeclared identifier is reported only once
layer0/ShaderMgr.c:173: error: for each function it appears in.)
layer0/ShaderMgr.c:174: error: ‘GLEW_VERSION_2_0’ undeclared (first use in this function)
layer0/ShaderMgr.c:185: warning: format ‘%s’ expects type ‘char *’, but argument 3 has type ‘int’
lipo: can't figure out the architecture type of: /var/folders/9+/9+lCZbKTGeSvLa-KoByjCE+++TI/-Tmp-//cc6lq8a7.out
error: command 'gcc-4.2' failed with exit status 1

Here's what I saw using Python 2.6 (which comes with Snow Leopard).

I did manage to find a solution, but it's a bit ugly and I'd like to see what I get from the PyMOL Users List before posting it.