Posted by & filed under Lessons Learned.

Since I just had to go through the steps to set up our development environment on my upgraded iMac, I thought I’d share them. If you have a setup you love, we’d like to hear about it! See this for setting up on Windows.

Goals of our setup

  • Create a local development environment for Apache, mySql, PHP and Perl
  • Set a wildcard local development domain (e.g. *.42u.local)
  • Integrate with our SVN Repositories

Our tools of choice

  • Apple iMac/Macbook
  • BBEDIT
  • Dreamweaver
  • Cornerstone (SVN client)
  • MAMP Pro (this is a nicely bundled apache, mysql, php bundle)
  • File Sync

Let’s get started.

Beware: huge downloads lie ahead. Find some bandwidth!

Prerequisites

There are a few, really large, packages we need just to get to the point where we can install the rest.

Xcode

Download this from the App Store. It’s free. And enormous.

Developer Command Line Tools

After you have it installed, you still need a few more tools.
Open Xcode, and then go to Preferences ➔ Downloads and select the “Components” tab. There you can click the install button next to “Command Line Tools”.

MacPorts

The MacPorts Project is an open-source community initiative to design an easy-to-use system for compiling, installing, and upgrading either command-line, X11 or Aqua based open-source software on the Mac OS X operating system.
MacPorts makes quick work of installing dnsmasq.
Follow these directions to install MacPorts: http://www.macports.org/install.php

dnsmasq

dnsmasq lets us set up wildcard records in our local DNS setup, something we can’t do in the hosts file alone. We could set up a full blown local DNS server, but this is much easier.

sudo port install dnsmasq

Using your favorite text editor open /opt/local/etc/dnsmasq.conf
add
address=/42u.local/127.0.0.1
Start dnsmasq with

sudo port load dnsmasq

add 127.0.0.1 to your DNS hosts in Network Preferences (don’t replace what is already there, just add it!)

Whew! Now let’s test out our DNS setup. You should see something like the following.

# dig home.42u.local
; <<>> DiG 9.8.1-P1 <<>> home.42u.local
;; global options: +cmd
;; Got answer:
;; ->>HEADER
;; QUESTION SECTION:
;home.42u.local.			IN	A

;; ANSWER SECTION:
home.42u.local.		0	IN	A	127.0.0.1

Set up our local webserver

Install MAMP

Get it here: http://www.mamp.info/en/downloads/index.html
It installs the PRO version along with the free version. For our purposes, we’re going to need the PRO version. Go ahead and license it. It’s worth it!
Set the general server settings. We generally set these to the defaults. Make sure you set a good root password for MySQL too!

Set up a virtual host. You can put your site files anywhere you like, but we generally put them in the Sites folder.

Edit the MAMP apache config template to add support for wildcard domains.
File -> Edit Template -> Apache
Add to the virtual hosts container (around line 582)
ServerAlias *.MAMP_VirtualHost_ServerName_MAMP

Start MAMP and test it out. In this example, we should get the default MAMP page when we go to http://home.42u.local

Install content into our shiny new document root.

For us, this is generally a clean WordPress Network install.

First do the Famous 5 Minute Install.

Follow that immediately with the Network Setup

Download and install our base network plugins:

  • Jetpack
  • All in One SEO
  • Custom Admin Branding
  • 42u HTML5 Upgrade
  • Edit Flow
  • Backup Buddy

Set up Subversion

The Repository

For our published WordPress plugins, we use the WordPress SVN repository. For our themes, perl modules and unpublished plugins, we use Beanstalk. Beanstalk is cool. We handle all our deployments right out of the Beanstalk cloud. Click. Done.

We store our working copies in sub-directories beneath Documents/Development. For themes and plugins we use the File Syncronization app to keep the files in the WordPress root in sync with the trunk. This frees us from the change/upload/test/revise cycle.

Cornerstone

There are a number of Subversion front-ends for Mac, but we love this one. Just like MAMP above, spring for the license. It’s worth every penny! (Beanstalk has a 10% discount code. Just sign up for a free account.)
Get it here: http://www.zennaware.com/cornerstone/index.php

Leave a Reply

  • (will not be published)