Member Sign In
Not a member?

A Wired.com user account lets you create, edit and comment on Webmonkey articles. You will also be able to contribute to the Wired How-To Wiki and comment on news stories at Wired.com.


It's fast and free.

Sign in with OpenID
Sign In
Webmonkey is a property of Wired Digital.
processing...
Join Webmonkey

Please send me occasional e-mail updates about new features and special offers from Wired/Webmonkey.
Yes No

Please send occasional e-mail offers from Wired/Webmonkey affiliated web sites and publications, and carefully selected companies.
Yes No

I understand and agree that registration on or use of this site constitutes agreement to Webmonkey's User Agreement and Privacy Policy.
Webmonkey is a property of Wired Digital.
processing...

Retrieve Sign In

Please enter your e-mail address or username below. Your username and password will be sent to the e-mail address you provided us.

or
Webmonkey is a property of Wired Digital.
processing...

Welcome to Webmonkey

A private profile page has been created for you.
As a member of Webmonkey, you can now:
  • edit articles
  • add to the code library
  • design and write a tutorial
  • comment on any Webmonkey article
Close
Webmonkey is a property of Wired Digital.

Sign In Information Sent

An e-mail has been sent to the e-mail address registered in this account.
If you cannot find it in your in-box, please check your bulk or junk folders.
Sign In
Webmonkey is a property of Wired Digital.

Tips And Tricks For Web Development In OS X Leopard

leopardbox.jpgMac OS X Leopard has a host of new tools for web developers. Python and Ruby on the Mac have been updated to 2.5.1 and 1.8 respectively and Leopard also sports Apache 2.2 out of the box.

This is good news for web developers, who previously needed to compile and install more recent version of their favorite development packages, but of course the newer versions of these open source tools are not without some hiccups for those accustomed to the older versions that shipped with previous incarnations of OS X.

Apache 2.2 is, for instance, very different than Apache 1.3 and many of your custom scripts and .conf files won’t necessarily transfer straight over — at the bare minimum you’ll need to update your scripts with Apache’s new location.

There’s some nice tips and tricks for web development in Leopard in this tutorial, which details the new locations for Apache and includes some tricks for PHP developers as well.

One notable change is that virtual host entries can no longer be created using the now defunct NetInfo Manager, instead you’ll need to edit your /etc/hosts file and add something like this:

127.0.0.1 mylocalmirror.dev

One big headache for setting up Apache 2.2 on Leopard is adding in mod_python. I stumbled across this thread which might help, but I still can’t get mod_python working with Leopard’s Apache 2.2. It might be a bit lazy web of me, but I know other people are trying to solve the same problem too, so if you know of any tutorials or have a tip, let us know in the comments below. Update: If you’re trying to get mod_python working, the trick is getting it to compile as a 64 bit file (At least on Intel Macs, which will be running Apache as 64 bit, so anything that interacts with it must also be 64 bit).

To get mod_python working grab the source for mod_python 3.3.1. Fire up the terminal and run:

$ gunzip mod_python-3.3.1.tgz
$ tar xvf mod_python-3.3.1.tar
$ cd mod_python-3.3.1
$ ./configure --with-apxs=/usr/sbin/apxs

Once configure has done its thing, it will create a file at src/Makefile. Open that file in your favorite text editor and add -arch x86_64 to the LDFLAGS line (line 27, just tack that bit on the end). Then look for the line (it should be line 49):

$(APXS) $(INCLUDES) -c $(SRCS) $(LDFLAGS) $(LIBS)

and replace it with:

$(APXS) $(INCLUDES) -c -Wc,"-arch x86_64" $(SRCS) $(LDFLAGS) $(LIBS)

Now hop back to the terminal and run:

$ make
$ sudo make install

Now you just need to add the mod_python module to your Apache .conf file and it should load without issues.

MySQL suffers the same fate. As long as you don’t need it to run via Apache (using mysqldb or the like) you should be fine with the OS X 10.4 version of MySQL, but so far as I can see there is no 64 bit version of MySQL for the Mac. I’ve tried compiling from source, but so far no luck.

Despite the hurdles these changes present, setting up a local web development environment in Leopard is significantly easier than previous versions of OS X and gives web developers access to the latest and greatest form of their favorite tools.

I’m going to have to amend that overly optimistic statement. Leopard has some great new tools for web developers, but because it’s so new, you may want to wait a while until the kinks are worked out and clear instructions make their way onto the web.

Post Comment Comments Permalink Print
Reddit Digg

 
Subscribe now

Special Offer For Webmonkey Users

WIRED magazine:
The first word on how technology is changing our world.

Subscribe for just $10 a year