Wired

Webmonkey

  • Web Dev & Design
    • Ajax
    • Backend
    • Blog Publishing
    • CSS
    • Databases
    • Fonts
    • Frameworks
    • HTML
    • HTML 5
    • JavaScript
    • Mobile
    • Multimedia
    • Programming
    • Security
    • UI/UX
    • Web Standards
  • Software & Apps
    • Browsers
    • Software
    • Web Apps
  • Platform & APIs
    • APIs
    • Identity
    • Location
    • Social
    • Web Services
  • Reference
    • Color Charts
    • HTML Cheat Sheets
    • Special Characters
    • Glossary
    • Templates
    • Code Snippets
  • twitter
  • facebook
  • RSS Feeds
Nov 2 2007
File Under: Programming

Tips And Tricks For Web Development In OS X Leopard

  • By Scott Gilbertson

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.

Tags: Programming
  • Post Comment  | 
  • Permalink

Comments (0)

All fields required
  • Posted by: Telanis | 11/6/07 | 6:21 am

    Funny image (related): http://www.toothpastefordinner.com/110607/pro-tools-installation.gif

  • Posted by: john | 12/10/07 | 3:05 pm

    http://www.opensource.apple.com/darwinsource/10.5/

    check it out for MySQL And seeing some of the other settings that were given to the various components installed in leopard.

  • Posted by: Web developer | 12/11/07 | 8:20 am

    How much does this development package cost? I’m thinking about purchasing it.

    http://www.ecommerce-land.com

  • Posted by: Jeff | 01/5/08 | 9:58 pm

    once I add a virtual host to the hosts file, is there a way to access the REAL host without re-edting the hosts file each time?

    I thought that by turning off local web-sharing that it might default back to looking for the REAL site, but this isn’t the case. Any way around editing the hosts file each time?

  • Posted by: Scott Gilbertson | 01/6/08 | 5:05 am

    @Jeff-

    Essentially no. That’s why the common practice is to develope with a made up host. For instance, if the live site is mydomain.com make an entry in the hosts file for mydomain.dev or mydomain.loc — that way you still see the live site when you go enter the real url, but you see your local site when you enter http://mydomain.dev/ or whatever. And of course if you’re using Apache you’ll need to define mydomain.dev in the apache config file as well (the local web-sharing preference you mention just turns apache on and off, it has no effect on the hosts file).

    hope that helps.

Webmonkey's Picks

Browse Our Tutorials

HTML, JavaScript, design and more

Cheat Sheets

HTML, CSS and special characters

Color Charts

Brighten up your pages

Cut & Paste Code

Templates and snippets you can steal

Recent Comments

  • Cialis-Injury-Lawyer on HTML Cheatsheet
  • John Bauer on Get Started With Python
  • Charles on Google Launches Web Store for Cloud-Based Apps
  • Abe on Drupal’s Creator Envisions Web Publishing’s Plug-and-Play Future
  • Marti on The Top Ten Reasons iTunes Sucks
  • Recent Articles

  • Webmonkey Goes South, Then West, for SXSWi
  • Shocker: New Study Shows Web Video Is Still a Mess
  • Google Launches Web Store for Cloud-Based Apps
  • Facebook Finds its Place in the Location-Sharing Landscape
  • Google Gets a New Geocoder
  • Corrections | Sitemap | FAQ | Contact Us | Wired Staff | Advertising | Press Center | Subscription Services | Newsletter | RSS Feeds
    Condé Nast Web Sites:
    Webmonkey | Reddit | ArsTechnica | Details | Golf Digest | GQ | New Yorker

    Registration on or use of this site constitutes acceptance of our User Agreement (Revised 4/1/2009) and Privacy Policy (Revised 4/1/2009).

    Wired.com © 2010 Condé Nast Digital. All rights reserved.

    The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of Condé Nast Digital.