How To Setup A New Mac For PHP Web Development
Inspired by 37 Signals post on how to set up a new laptop for Ruby development, I thought it would be worthwhile sharing how I configure my own laptop in preparation for development. It’s a process I had to go through over the past 48 hours as I was forced to wipe my entire hard drive when installing the new Mac OSX Lion.
My current project, Holler.com, has been built entirely by me with the help of a front-end web developer (Johannes Ma) who cutup the creative director’s (Dann Petty) PSD files. The project has a back-end in PHP, a Mongo database currently hosted with MongoHQ, an iPhone app, Git for source control, Capistrano for automated deployment, Pubnub for real-time messaging, UrbanAirship for push notifications, and IndexTank for search indexing.
I decided to offload most of everything to third-parties because I don’t want to be responsible for managing multiple moving parts once the app is live. That’s a business decision, not a computer science decision. It will be interesting to see how that decision plays out. While I’ll go into more detail about Holler in a future post, I figured I’d walk any developer readers through a quick overview of how I set up my laptop.
- Install dropbox - Aside from local development projects that I simply sync through github, dropbox stores all of my files. I need to have this installed to get up and running. The only downside is that it can take upwards of 24 hours for my files to get downloaded when first installed. You could probably run a local backup if you wanted to accelerate this step, but then why would I have dropbox in the first place?
- Install Solarized theme - I like pretty colors. That’s why I use the Solarized theme in the Mac terminal and in textmate.
- Enable Super User - Apparently Apple turns off the ability to run the sudo/su command in the terminal by default. As such you have to manually turn it on. Here’s a relatively recent how to article in the Apple knowledge base. If you are running Lion, the command sequence is slightly different but you can just look it up in the help area after opening “System Preferences” and clicking on “Users & Groups”.
- Set up apache - While it sounds like Pow, the app originally linked to in the 37Signals post, is useful for ruby developers, I’m still using PHP (I know, old school!). Maybe one day I’ll make the jump, but in the meantime, I’m using good-ole apache for running my apps. This process entails editing your local hosts file, turning on virtual host support, uncommenting the php module and virtual host support in httpd.conf, setting AllowOverride to All (to support .htaccess files), and restarting apache. Pretty quick if you know your way around apache.
- Install and configure git
- Get Textmate - I use vi for all my terminal-based editing, however I prefer doing most of my web development in Textmate. After using XCode’s comprehensive IDE, I have to say that most text editors are feeling pretty pretty weak now.
- Install Photoshop and XCode - I use photoshop for all photo editing and XCode for all my iPhone development stuff.
- Install macports - I actually don’t use macports for much but it helps the mongodb install process a lot easier. I like having a local db set up when doing my development. If I was using MySQL I’d install that as well.
- Install mongodb - Now that macports is installed I install all the required packages before installing mongodb with sudo port install mongodb.
- Install pear - I have a few pear modules installed, including the mongodb driver for PHP so I install that. Also, remember that you need to add mongo to the php.ini file by adding the line extension=mongo.so.
- Install mbstring - I’m personally a big fan of the mbstring module for all my foreign character related stuff. While I’m sure there’s a more efficient way of handling unicode stuff, mbstring has worked brilliantly for all my past projects. Once I’m done with those steps, I have pretty much got my entire development environment up and running! Now all that’s left is imagination and persistence to building the next great thing (as long as you want it to be powered by PHP ;)) Have any tips on setting things up or tool that make your life easier? Feel free to post those in the comments!