Developing PHP on A Mac

email-addthis printer-addthis favorites-addthis facebook-addthis digg-addthis | Share

23 May 2011 07:43:53
Category: PHP Development

For the past 9 months I have been working professionally on a Mac book. Goes without saying, Apple has created a beautiful interface for their completely developer unfriendly OS. But hey you can't win every game can you? This isn't my first foray on a Mac. 3 years ago I was on a Mac book and I struggled then to find an environment that I liked.

Enter attempt 2

This time instead of trying MAMP, I went for the Zend Server Community edition. That worked out okay after I figured out that I need to put my web files on a case-sensitive partition. Macs ship with a case-insensitive file system and you can run into problems if you are deploying your app to a traditional Linux server. Then there is the funky 64 bit build on these machines which makes compiling PHP extensions more difficult then it needs to be. The Zend Server Community ships with a 32 bit build so you can't pecl install any php extensions without some adjustments.

Frustrated I turned to Virtual Box and got Ubuntu running.... Ah ... home sweet home again. I love working on Ubuntu. It's been a main stay environment at home or at work for several years. But, VM's run slow and there's always a reason to go back to your Mac OS for this or that.

Frustrated.

I decided the best strategy would be to keep my IDE in my native Mac environment. So, I got networking set up on VM Ubuntu install. With networking installed I was able to ssh on to my VM with my Mac terminal.

Then I set up MacFuse which allowed me to mount my VM's website workspace to my Mac environment via SSHFS.

With this I could set to work, keeping my Mac still a Mac and my development environment still on Linux and Ubuntu. That is I could use my pretty finder and mac apps to write my code while my code was still in the environment deployed in.

In probing several different types of editors for SSHFS compatibility I found several that worked fine:

  • Komodo
  • Text Mate
  • VIM
  • NetBeans
  • Coda
Somewhat disappointingly I couldn't get Eclipse, PDT, or Zend Studio to write over the mounted SSHFS file system. You can set up remote projects with these tools that will save and upload the files to the remote server automatically. But no thanks, I can't go back to my days of working with Dreamweaver and two sets of physical files. 1 minute of lost time due to a file not saving properly is not acceptable.

I've been using this environment for 3 weeks now and I couldn't be happier with it. Seems to be the way to go on a Mac for development.

On my next post I'll share some of the tools I used to set up this environment.