Zope Buildouts for Plone on OS X: Heaven or Hell?

After fighting with Zope/Plone Buildouts for a few days, and some help from the mailing lists, I finally have a recipe that seems to work for Mac OS X (Leopard). May it ease as much Buildout pain for you as it has caused for me!

Install Python and PIL

Leopard ships with Python 2.5, and Plone and Zope developers vehemently state that Buildout is compatible with Python 2.4 but not Python 2.5. So, you’ll probably need to install both Python 2.4 and the Python Imaging Library (PIL) on your system, if they’re not already installed. Using MacPorts, that’s as simple as:

sudo port install python24

sudo port install py-pil

Notes for MacBook and other Intel Mac users

It seems that PIL is not easily installable in a default Leopard environment, as for some reason, the Python framework is built on the assumption that any system architecture will be PPC as opposed to Intel. Since I’m working on a MacBook (Intel), this invoked a bit of grief for me, and nothing I could do would cause attempts to install or compile PIL to complete successfully.

I happened to find a blog post on the O’Reilly Network that proposed a fix: remove all references to “-arch ppc” from the Python framework Makefile, which in my case was at:

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/config/Makefile

Install Easy Setup and ZopeSkel

Change to your target directory (preferably, one not owned by root, but you can always “sudo chown -R …” later if necessary) and enter:

wget http://peak.telecommunity.com/dist/ez_setup.py

sudo /opt/local/bin/python2.4 ez_setup.py

sudo /Library/Frameworks/Python.framework/Versions/2.4/bin/easy_install ZopeSkel

Create your Buildout

Once ZopeSkel is installed, creating your buildout is as easy as:

sudo paster create -t plone3_buildout [your_buildout_project_name]

sudo chown -R [your_user_name] [your_buildout_project_name]

cd [your_buildout_project_name]/

Edit the buildout.cfg configuration file to your liking. You can see mine here.

Then, “bootstrap” the installation of your Buildout instance:

/opt/local/bin/python2.4 bootstrap.py

Then it’s time to perform the actual Buildout:

./bin/buildout -v

Add a Zope admin user:

./parts/instance/bin/zopectl adduser admin [your_password_here]

Finally, you can start your Buildout instance! Test it first by running in debug mode:

./bin/instance fg

If that works without errors (not warnings, just errors), you can stop it [Ctrl+C], and then start it back up normally:

./bin/instance start

Done! Wasn’t that easy? 😉 Now mosey on over to your new, local, built-out Zope instance, usually here:

http://localhost:8080/manage

Log in as your admin user, and have fun!


Update:
If you’re following along with Martin Aspeli’s Professional Plone Development (Packt Publishing), and you’re up to page 71 and editing the configure.zcml file for your Policy product, you may not realize that you need to add the un-bolded XML namespace declaration for GenericSetup, since the other additional code in the example is called out in bold text. Not adding this declaration will screw up your project! Click here for a highlighted example of the correct code.

One thought on “Zope Buildouts for Plone on OS X: Heaven or Hell?

  1. You may also install setup tools via MacPort like

    $ sudo install py-setuptools

    which installs easy_install-2.4 in /opt/local/bin so you don’t have to download and install it manually.

Leave a comment