Using vagrant for developing on OSX: whyΒΆ

Tags: python, django, plone, apple

All the years that I’ve used a mac, I’ve been doing my programming on the mac itself. OSX itself is a unix system, so that’s fine. And with macports (or fink or that other one that I’ve forgotten) I can easily install the bunch of extra utilities that I need.

When I worked with plone, this worked really well. The only external dependencies that you had to deal with were PIL (so: libjpeg-dev and friends) and sometimes lxml’s libxslt/libxml dependencies. Especially lxml could give you grief on OSX, but with the use of the z3c.recipe.staticlxml recipe everything was fine.

Django, which I work with now, is likewise easy to install and develop for on OSX. That is, until you get to geodjango. And we’re using a whole lot of geo stuff in our websites, so you need a whole geo stack. Geos, gdal, mapnik. And often numpy and scipy. And spatialite instead of the bundled-with-python sqlite.

All of this is just a big sudo apt-get install .... on ubuntu, but on OSX it is grief. I managed to get it working most of the time:

  • I tried the kyngchaos packages first. Collecting everything and getting everything working with the right python versions was quite some work at the time. Perhaps it is easier now. This worked for a while, but I kept having problems using other libraries: those were often easier to install with macports or fink, but then you used macports’ python instead of the system python used by kyngchaos...
  • Fink. Installing works fine, but the packages were a bit old.
  • Macports. Currently the best way to get everything going, but I still ran into some problems:
    • I couldn’t get spatialite to work. So I had to do all my work with postgresql-with-postgis.
    • You install everything for python 2.7. Suddenly it turns out that python-mapnik (iirc) is only available for 2.6. Alrighty, let’s do it all again.
    • Update to mountain lion. Oh, xyxwidkcygxy, I have to de-install macports and install everything again from start!
    • Update to mountain lion. Oh, my postgres server disappeared. Did I install that from the postgres installer? Or from macports? Oh, and I have to install all those postgis templates again.

Solution: use vagrant to quickly get a decently-set-up ubuntu virtual machine inside virtualbox. Now I get to use the regular ubuntu packages and everything Just Works.

In a later blog post I’ll tell you how I set it up. This one’s long enough already :-)

blog comments powered by Disqus
 
vanrees.org logo

About me

My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):