Readline and Python 2.5+ on OS X
October 31, 2008
This is really just a “note to self” kind of post. I meant to write this down a while ago but I forgot. To prevent further forgetting, here it is:
I always compile Python myself. The Python that comes with OS X tends to get outdated pretty soon and it has outdated libraries in its
site-packages directory. And beware installing or updating anything in there, it might ruin core components of OS X (because they actually use this Python instead of one that’s not the user’s to modify). I know that MacPorts too has various Python versions but it then again it applies various patches to them and builds them in weird manners that I don’t understand (framework, etc.). So the best bet to get a clean and reliable Python installation is to self-compile (and then use virtualenv to prevent it from being messed up).
As it happens, when I compiled Python 2.5 or higher on OS X, it linked to either the OS X readline library or the MacPorts one. Which one I don’t know, but it was definitely hosed. So while the interpreter worked fine, the interpreter shell would crash with a Bus Error. So what I did was compile my own plain vanilla version of readline and installed it to
/opt. Of course that didn’t work right away because readline wouldn’t build on OS X Leopard without applying a small patch to a build script.
./configure --prefix=/opt --with-readline-dir=/opt
and did the usual
make && make install dance.