Dropping MAMP for a Better Web Development Environment on macOS

I have been a MAMP user for a long, long time—ever since I started developing with WordPress back when it was really just a blogging platform. MAMP is a breeze. It’s easy to setup new test sites, and the behind-the-scenes configuration of Apache, MySQL, and PHP made life simple.

I realized I had a problem when my MAMP Pro software started to become severely incompatible with my projects. Rather than shell out for a new license, I decided it was a good time to re-evaluate my local development setup.

There are several excellent resources I relied on to upgrade my stack, so this post is more of my notes on the process I went through.

I first followed The Perfect Web Development Environment for Your New Mac, posted by Chris Mallinson. He did a superb job on outlining each step I needed to run through, including:

  • Installing MySQL for the local database
  • Setting up dnsmasq to route .dev requests appropriately
  • Modifying Apache to work with the new environment

Apache was a bit of an odd ball situation. macOS comes packaged with Apache, but several modifications were needed to get it working properly. Instead of mucking around with system components, I decided to use the guide, macOS 10.13 High Sierra Apache Setup: Multiple PHP Versions, posted by Andy Miller on the Grav CMS blog.

This guide outlines the steps to install Apache and PHP via Homebrew. There is some contention over becoming too dependent on Homebrew for components that are available at the system level, but I decided that separating out my local development environment would give me the most flexibility. I also like the prospect of easily switching between different versions if ever needed.

I used the Apache modifications from Chris Mallinson’s guide to tell Apache to look into my projects directory and render wwwroot directories as web applications. That means to create a new domain, all I need to do is make a “client” folder in my projects directory and then a “wwwroot” folder within the client. I can then open the content of wwwroot under client.dev. Much easier than MAMP!

The biggest hiccup in my new environment was the conflict between Apache and pow, an add-on Rack server for Rails. Both were competing for port 80, so I needed a way to differentiate the traffic.

After reading the 37 Signals gist on modifying pow to play nice with Apache, I tried implementing their configuration. This is where I spent the most time. After modifying and re-modifying Apache, and installing and uninstalling pow multiple times, I ended up not using the Apache configuration in this guide. Instead, I access all Rails apps using the 88 port specified in the powconfig file. So, my apps look like this:

  • Apache: http://wordpress.dev
  • Rails: http://rails-app.dev:88

I’m sure I made a few mistakes in my journey to improve my local setup. In messing around with Apache, I’ve realized how much more I want to learn about DevOps. I can blindly change settings and anticipate the results, but knowing exactly what those settings do and how I can better optimize them is a good challenge.

Here are some other guides and notes that helped me:

See more posts