Sunday, April 24, 2011

Get Started with Dexterity Development for Plone 4 on OS X

update: I've updated the steps so that they work for OS X 10.5 and 10.6 as well.

For this recipe you'll use:
  1. OS X 10.4 or better with XCode installed
  2. The Plone Unified installer (latest stable version 4.0.5)
Estimated time: 35 minutes
Remember to get XCode installed before trying any of this.

While I'm sure there are faster ways to get this done, I think this approach requires the least number of steps and gives you a working development system. This is also easily adapted for a Linux platform.

Step 1 - Get Plone Installed (estimated time 10 to 20 minutes)

If you are using OS X 10.5 or 10.6 do the following:
  • Download the latest stable OS X installer .dmg file from http://plone.org/products/plone/releases/4.0.5
  • Start the GUI installer
  • At 'Installation Type' select 'Other' and browse to 'Desktop' and create a folder called 'dexterity'. Ensure that 'dexterity' is selected and click 'Continue'.
    skitched-132
If you are using OS X 10.4 do the following:
  • Cut and paste the following into your terminal:
curl -O http://launchpadlibrarian.net/68926027/Plone-4.0.5-UnifiedInstaller.tgz
tar xvfz Plone-4.0.5-UnifiedInstaller.tgz
cd Plone-4.0.5-UnifiedInstaller
./install.sh standalone --target=$HOME/Desktop/dexterity
cd $HOME/Desktop/dexterity

(On an old single core Macbook Pro the above command took about 20 minutes to execute, which includes compiling a complete copy of python 2.6.)

Make a note of your admin password. If you need to find it again it is located at Desktop → dexterity→ zinstance→ adminPassword.txt or you can paste this in your terminal:
open $HOME/Desktop/dexterity/zinstance/adminPassword.txt
Step 2 - Add plone.app.dexterity to your buildout configuration (estimated time 5 minutes)
Now with your favourite editor navigate to the Desktop/dexterity/zinstance folder and open the buildout.cfg file with VIM your favourite text editor.

cutting and pasting this into your terminal should do the trick

open $HOME/Desktop/dexterity/zinstance/buildout.cfg

This requires adding two lines, one in the the 'extends' section and the other in the 'eggs' section.

extends =
http://good-py.appspot.com/release/dexterity/1.0-next?plone=4.0.5

eggs =
Plone
PIL==1.1.6
plone.app.dexterity

Then run the buildout command (you can cut and paste the following):

$HOME/Desktop/dexterity/zinstance/bin/buildout -n

note: the -n means 'look for newest packages'. It is definitely needed the first time to ensure that you get up to date packages.

Step 3. - Kick the tyres, ensure everything is working.
Now that everything is installed let's see if it works.
Start your instance by running the following command (you can cut and paste it into your terminal):

$HOME/Desktop/dexterity/zinstance/bin/instance fg

You should see output similar to this:


Now visit http://localhost:8080 with your web browser, you'll see something like this:

Click 'Create a new Plone site' and accept the defaults.
Then go to 'admin''Site Setup' → 'Add-ons', check 'Dexterity content types' and click 'Activate'.


Now go back to "Site Setup", select "Dexterity Content Types" and start tinkering with it.




Troubleshooting
The most common issues are related to either not having XCode installed on your Mac or being on a network which relies on a proxy. If you need to work with a proxy a quick fix is to export your proxy settings just before initiating the download etc.. Like so:

export http_proxy=http://theproxy:theport
e.g.

export http_proxy=http://192.168.0.1:8080

No comments:

Sign up for my upcoming Plone 5 Book & Video tutorials

plone 5 for newbies book and videos