February 2017
How to set up a local web development environment using MAMP PRO
Filed under: Tutorials, Web Development

A beginner-oriented walkthrough for preparing a local Mac development environment with MAMP PRO.
Why work locally at all
Editing files directly on a live server is fast until the moment it is catastrophic. A local environment means every change is tested somewhere private first, and a mistake costs a page refresh rather than a public outage.
It also means you can work on a train. That is a smaller argument than it sounds until the first time it matters.
What the stack consists of
A local web stack is a web server, a database and a scripting language running together on your own machine. MAMP PRO bundles those into a single application with a control panel, which removes most of the configuration work that used to be the barrier for people coming from design rather than systems administration.
Setting up a host
The workflow is short. Create a host, point it at the folder holding the site files, choose the document root, and start the servers. MAMP PRO can map a readable local hostname to the project rather than a port number, which makes it far easier to keep several projects straight.
For a database-backed site, create the database through the bundled administration tool and note the credentials somewhere sensible before configuring the site to use them.
Keeping local and live in step
The most common source of confusion is a site whose stored URLs still point at the live domain, so a local copy quietly loads live assets. Checking the configured site URL after every database import saves a lot of confused debugging.
It is also worth matching the language and database versions your host actually runs. A local environment that is two major versions ahead will happily accept code that the production server rejects.
Next entry: Showcase: Solve your Git errors with ohshitgit.com
Previous entry: SCSS Mixins: 5 awesome and creative examples
Back to February 2017 or the front page.