Archive for August, 2008

Tutorial: Launching MAMP Silently on Startup

Monday, August 25th, 2008

MAMP Web ServerMAMP is a great tool for running and managing a development server when you require more than the basic PHP configuration included with Leopard. However, getting the web server to run typically involves launching MAMP, entering your root password, and quitting MAMP.

This tutorial walks through the simple steps needed to launch MAMP silently on startup so that you do not have to enter your root password every time.

The issue with MAMP is that launching Apache must be done as root, so there’s no way to simply add MAMP to your startup items via the system’s Accounts Preferences in a way that will launch the app silently. But you don’t need to. Here’s the deal: MAMP’s launcher is just a pretty UI that opens a shell script that, in turn, launches MAMP’s Apache and MySQL servers.

You can set up launch daemons that do the exact same thing without the need to launch MAMP or enter a password.

Step 1: Create the Start-up Items

Open up your favorite text editor and paste the following into an empty document:

Create another for the MySQL start-up item:

Be sure to replace “YOUR_USERNAME” with the username for your account.

Step 2: Save the Files

Save this file as (or move the file to) /Library/LaunchDaemons/info.mamp.start.apache.plist and /Library/LaunchDaemons/info.mamp.start.mysql.plist, respectively.

Step 3: Set Permissions

If you try to launch the daemons at the moment, you’ll get a “dubious permissions” error. To correct this problem, you’ll need to change your permissions.

In your terminal, type:

You’re done! Reboot your computer and test that your development server is running as expected by opening a served page in your browser.

Sphere: Related Content

Integrating the iPhone SDK Simulator into Dreamweaver

Sunday, August 24th, 2008

Are you doing iPhone development on a Mac? Do you use Dreamweaver as your IDE? If your answer to both questions is ‘yes,’ then try this simple tip.

The iPhone SDK has an iPhone simulator that is, effectively, a fully functioning, pixel-perfect iPhone on your Mac. But because it’s an app on your Mac, it is also just another browser on your system. So treating it as such in Dreamweaver is a snap.

First, download and install the free iPhone SDK from Apple’s iPhone Development Center. Since you are not releasing apps through the App Store, you do not need to pay to be a part of the Application Developer Program. You just need a free developer account on Apple’s site.

Once you download and install the SDK, open up Dreamweaver.

  1. Go File > Preferences > Preview in Browser
  2. Click the “plus” button to add a new browser to your list
  3. Navigate to /Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/
  4. Select the iPhone Simulator.app
  5. Click Ok, and then close out your preferences
  6. Now the iPhone Simulator is in your list of browsers

There’s one quirk. The iPhone Simulator must be running in order for it to accept browser pages from Dreamweaver, so if you trigger it from Dreamwever and all you see is the iPhone’s Home Screen, then do it again in Dreamweaver. The second time, the page should come up in the iPhone’s browser.

Sphere: Related Content

Adding a $PATH environment variable in OS X 10.5 (Leopard) Terminal

Sunday, August 24th, 2008

One thing that will inevitably come up when setting up a web server using MAMP on OS X Leopard is the need to add the PHP and PEAR binary paths to the Terminal $PATH variable. Fortunately, this is dead-simple.

Open a Terminal window and type the following (assuming you’ve installed MAMP in /Applications):

export PATH=/Applications/MAMP/bin/php5/bin:$PATH

If you’re using PHP4 instead, you’ll want to specify that path instead.

Now type the following to see your newly edited $PATH environment variable:

echo $PATH

You should see your MAMP PHP binary path tacked onto your $PATH string.

Now type the following:

pear upgrade-all

If everything went according to plan, you should see the output from Pear updating itself.

Sphere: Related Content