Plone Buildout on Snow Leopard… from the ground up

This is how I got a fresh Plone buildout up and running on my brand new iMac. I’m writing this mostly for my designer buddies here in Nashville, in the hopes that one day they will come to the light and start skinning Plone sites with me. We can dream can’t we?

Major thanks to Brian Gershon (without this blog post it would have taken me until the Ides of March to get through this), and especially Florian Schulze for his buildout that makes Python 2.4 on Snow Leopard a snap.

Step 1: Find Your Mac OS X Install DVD

Okay, if you’re like me, you don’t know where your install DVD is. Unless, of course, you’ve broken the seal on your new Mac less that 24 hours prior.

If you have your Install DVD:

  1. Insert the DVD, open it, and open “Optional Installs”
  2. Double click “Xcode.mpkg”
  3. Let Xcode install on your machine. It took me between 15 and 20 minutes.

If you DON’T have your Install DVD:

  1. Go to http://developer.apple.com/TOOLS/Xcode/
  2. Click “Download Latest Xcode”
  3. Create an ADC membership if you haven’t already (it’s free)
  4. Download the package (it’s a doozy, 2 GB+)
  5. Double click the package file after you’ve downloaded it
  6. Let Xcode install

Once you’ve gone through the install process, open up Terminal by going to Applications -> Utilities (go ahead and drag it to the dock, you’ll need it later). Type ‘gcc’ into Terminal and press Return. You should get something like the following:

i686-apple-darwin10-gcc-4.2.1: no input files

What’s that, you say? Why, that’s your brand new GNU C Compiler telling you it needs an input file before it can do anything! If you see something different, you probably had a problem installing Xcode.

Step 2: Installing Python 2.4 (and other goodies)

As I’m still working in Plone 3, I’ll have to install Python 2.4. SL ships with Pythons 2.5 and 2.6. Usually it’d be easy to install different versions of Python, but according to Brian’s post SL mangles up a Python 2.4 installation. Here come’s Florian’s buildout to the rescue.

NOTE: This installation method is specific to some problems that Snow Leopard had with Python 2.4. Details available here and on Brian’s blog.

To Install Python 2.4 and the rest of the gang:

  1. Open Terminal
  2. Create a new directory called ‘src’ in your home directory by typing in the following command
  3. mkdir src
  4. Move into that directory with this command
  5. cd src
  6. Checkout and run Florian’s buildout with the following commands
  7. svn co http://svn.plone.org/svn/collective/buildout/python/
    cd python
    python bootstrap.py
    bin/buildout

You should now be able to run Python 2.4 by typing the following code into Terminal:

python-2.4/bin/python2.4

That’s the Python2.4 deep inside your user directory. As it stands, you’d have to use the full path to that file to run Python 2.4. Let’s change that.

Symlinking Python 2.4 to the path:

The goal here is to be able to run Python 2.4 by simply typing “python2.4” into the Terminal. To accomplish this:

  1. Change to a directory in your path (I used /usr/bin)
  2. cd /usr/bin
  3. Type in the following command, substituting your username for “kevin”. You’ll have to type in your password, as we’re editing system files here (type carefully!)
  4. sudo ln -s /Users/kevin/src/python/python-2.4/bin/python2.4 python2.4
  5. Go back to your home folder, and try running Python 2.4 without the path
  6. cd ~
    python2.4

If you get a Python 2.4 interpreter (see below), you’re golden.

Python 2.4.6 (#1, Dec 29 2009, 23:33:05)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

While we’re at it, let’s symlink easy_install-2.4 as well. We’ll need this for ZopeSkel:

cd /usr/bin
sudo ln -s /Users/kevin/src/python/python-2.4/bin/easy_install-2.4 easy_install-2.4

If you ever happen to meet Florian Schulze, thank him for this buildout.

Step 3: Creating a Plone 3 Buildout (finally, right?)

To make a buildout, we’re gonna need Paster. To get Paster, we’re gonna need ZopeSkel. Let’s use that newly symlinked easy_install-2.4 to get ’em.

cd ~
easy_install-2.4 -U ZopeSkel

This installs what we need, but again deep in our user directory. A symlinking we will go:

cd /usr/bin
sudo ln -s /Users/kevin/src/python/python-2.4/bin/paster paster-2.4

Notice I named this particular Paster “paster-2.4”. That’s in case we ever install paster for a different version of Python, we’ll know which one is which.

Now let’s pick a home for our buildouts. I like to create a directory called “workspace” next to my “src” directory (sigh… good ol’ Eclipse). Make that directory, and move into it with these commands:

mkdir workspace
cd workspace

To start a new buildout, type the following command:

paster-2.4 create -t plone3_buildout myplone

Paster will ask you a lot of questions, like what version of Plone you want, and which Zope to use. Hit enter to accept all of the defaults. When Paster is done running, go into the directory you just created, bootstrap the buildout, and run buildout with the following commands:

cd myplone
python2.4 bootstrap.py
bin/buildout

If buildout ran without any errors, the last line of the Terminal output will look like this:

Generated interpreter '/Users/kevin/workspace/myplone/bin/zopepy'.

Step 4: Starting Plone

With our buildout created, now we simply start Zope with the following command:

bin/instance start

Point your browser to http://localhost:8080/manage_main, type in the username and password you supplied to Paster, and add a Plone site through the ZMI. Welcome to Plone on Snow Leopard!

One thought on “Plone Buildout on Snow Leopard… from the ground up

Leave a Reply

Your email address will not be published.

*
= 4 + 6