Select Page

Using MAMP Pro as a Local Development Server

MAMP Pro is great.  It does a number things well which helps streamline the development process. The primary reasons I use MAMP Pro is that I can pull my sites from git into my local MAMP server, import the database quickly (including large SQL files), and it renders right in my browser right away at http://dev-projectname:8888 with very little setup.  I will show you how to edit some configuration settings to get you setup and working quickly.

Setup your Dev environment:

  1. Using your Finder go to /Applications/MAMP/htdocs/ and create your Document Root folder for your project. Import your project files into this folder. Note: this htdocs folder is located at c:\MAMP\htdocs\ on the Windows version.
  2. Using MAMP Pro click the Hosts tab in MAMP Pro and click the + button on the bottom left.
  3. Add your development project details. I generally go with dev-projectname as the Server Name. This is what you will load in your browser to see your website some servers set this to localhost but I find dev-projectname is more useful for my purposes. The only other option you edit under Hosts is the Document Root which you set to the folder you created in Step 1.
  4. Click the Start icon in the top right and this gets your server running.
  5. Your website will now load in http://dev-projectname:8888.

The reason you want to use MAMP Pro is so you can develop your sites using http://dev-projectname:8888 rather than http://localhost/projectname:8888 which is a subdirectory and you run into issues with absolute URL paths. Just upgrade and use the Hosts feature. It’s so worth it.

Create/Import your Database:

  1. Click the MySQL tab and click phpMyAdmin to open that in your browser.
  2. Click the New link on the top left above the database list.
  3. Name your database dev_projectname.  You can name the database whatever you like but to keep it organized I name it the same as the Server Name I created in the first set of instructions. Note that I use an underscore for the database name and a hyphen for the project URL.
  4. Now you can import your database.
  5. Edit your website configuration files to connect to this local database.

Importing large .sql files using phpMyAdmin:  

If you are seeing this error “You probably tried to upload too large file. Please refer to documentation for ways to workaround this limit.” You need to edit your configuration files inside MAMP to import a database larger than 32MB.

  1. Go to the PHP tab in MAMP Pro.  Make note of the PHP version you are using.  I set my version to 5.6.x to match the version running on my Production Web Server.
  2. Go to File > Edit Template > PHP > select the version of PHP your server is running.  Edit the following settings and save:
    • post_max_size = 256M
    • upload_max_filesize = 256M
    • max_execution_time = 600
    • max_input_time = 600
    • memory_limit = 512M
  3. Restart your server and you should now be able to upload up to 256MB to your database.

Now that everything is running you should be able to quickly pull your sites from Github into your MAMP server; export your large database from Production and import it right into your local Dev; and have it all render at http://dev-projectname:8888 quickly. Make your edits and push your changes right onto QA and Production like a champ.