How to Install Pida on OS X

For some reason, I got it into my head that I wanted to try out Pida (a Python IDE that embeds Vim or your editor of choice) on my Mac. Well, actually from the description, it sounds pretty cool, right? The screenshots are pretty neat too. Unfortunately, the end result on OS X is somewhat less than compelling.

However, it was a huge fight getting it setup, so I figured I’d write this down for posterity.

There is a PIDA MacPort, however there is no maintainer, it’s for Python 2.6 only, and it didn’t work out of the box for me. You’ll need to fight it enough that you might as well go whole hog. Here’s how I got Pida running w/ MacPorts python27.

First the ports:

sudo port install librsvg py27-gtk py27-gnome dbus-python27 py27-notify-python
sudo port install vte +python27
sudo port install vim +python27 +x11 +gtk2

Then the Python libraries:

sudo easy_install py
sudo easy_install pygtkhelpers
sudo easy_install Logbook
sudo easy_install bpython

Next, after grabbing the source, your build environment:

PKG_CONFIG_PATH="/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/pkgconfig" PATH="/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin:$PATH" python setup.py build_ext --inplace
running build_ext

Now, you’ll be able to run, but you may get a dbus error (which won’t let you select your editor among other things). Here’s how I made sure that dbus was running:

launchctl list | grep dbus
sudo launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-system.plist
launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist
launchctl list | grep dbus

Note above that dbus-system should be as root, and dbus-session should be loaded as the user.

Once I did this I was able to get up and running, however the Python shell subprocess throws an exception for me, and the font rendering and overall look, and of course all the non-vim keyboard shortcuts are painfully alien. Sadly, if you’re looking for a vim-like IDE-ish solution on the Mac, I think Vico, while quite new and still incomplete, is probably a better bet. If you’re looking for better Python introspection/debugging with a not-totally-awkward keyboard shortcuts (and incidentally, dead easy OS X installs), Reinteract and iep look to be the best choices I’ve found. (There’s also Spyder, which has a python26 Macport, but it depends on qt4-mac which may cause your MacPorts to build the world.)