Installing Craft on OS X using MAMP

By: Adam McCombs | Founder at Taecho

Published Oct 26, 2015 | Last Updated Feb 14, 2016

Tech Reviewed by Lindsey DiLoreto Robert Banh | Edited by Terry Martinez


Installing Craft on your local computer is a relatively simple process if you're going to use MAMP to power your install. Let's go ahead and get started.

Step 1: Download and install MAMP #

Already got MAMP downloaded and installed? Skip to step 2.

Before we get started with Craft, we're going to need something to power our Apache, MySQL, and PHP stack on our computer. MAMP which stands for Mac, Apache, MySQL, PHP is an all-in-one application that allows us to run Craft (and other PHP based applications) without having to modify any of the built in software options originally packaged with OS X.

Once you've downloaded MAMP, go ahead and install it.

Step 1a: Download Sequel Pro (optional)

This step isn't required but if you haven't heard of it, I'd suggest you download Sequel Pro to work with your databases (locally or remotely). We won't be using it for this tutorial but it's worth the time to download and setup. It even includes a socket to connect to MAMP so it's super simple to setup.

Step 2: Create a new database #

One thing we'll need to install Craft is a MySQL database. If you are using Sequel Pro, and you've already setup a connection to MAMP, this is as easy as opening your MAMP connection (if you saved it to your Favorites) and selecting Add Database under the Choose Database dropdown. You can also do this from the main menu under Database ~> Add Database.

If you're going to use the built in phpMyAdmin that comes with MAMP, first click on Start Servers button on the right and then click on the Open WebStart page link.

The MAMP Application window. Click on the Open WebStart page

Once it opens, you'll see the MAMP webstart page. Look under the MySQL heading on the lower left and click the phpMyAdmin link.


The MAMP webstart page. Click on the phpMyAdmin link, in the lower left.

Once you've got the phpMyAdmin window open, click the Database tab and you should see a Create Database text field.


The create database tab inside phpMyAdmin.

For the sake of sanity, regardless of which type you use (phpMyAdmin or Sequel Pro) let's name this database craft_db. Remember this name because we'll need to add it into our Craft database config file in a few steps.

Step 3: Download Craft #

This next step is pretty simple. Just visit buildwithcraft.com and click the download button on the upper right. Once you agree to the terms and conditions, Craft will save a zip to wherever your browser saves files (probably your downloads folder or desktop).

Next you'll need to unzip this file and move its contents to your htdocs folder. Don't know where that is? Well, the good news is that when MAMP was installed, it created this folder. Check for a folder located here: Applications -> MAMP -> htdocs.

Step 4: Adjust Config Files #

At this point it's probably best if you jump into your code editor of choice. If you're using Atom or Sublime Text, you can set up your Craft files as a project, but if you want to edit these files individually, go for it.

Step 4a: Edit your craft/config/db.php file

Open your db.php file located inside your htdocs folder at craft/config/db.php. Edit the file so that it looks something like the following (condensed for space). Make sure the craft_db is filled out in the database name field.

<?php 
{
    return array(
    'server' => 'localhost',
    'user' => 'root',
    'password' => 'root',
    'database' => 'craft_db',
    'tablePrefix' => 'craft',
    );
}

Step 4b: Rename your htaccess file

Craft uses a .htaccess file to route URLs to where they need to go, however, when you first download craft, this htaccess file does not have a period in front of it. Locate your htaccess file at /public/htaccess and rename it so it has a period in front of it.

If you would prefer to just rename this file outside of your code editor, you'll need to open up your terminal and tell OS X to show (and unlock) hidden files by running the following command.

defaults write com.apple.Finder AppleShowAllFiles YES

Once you run this command, you should be able to rename your .htaccess file from your finder and still see if afterwards in case you made a mistake.

Step 5: Change Document Root #

Because Craft runs out of the Public folder for an additional level of security, you'll need to adjust the document root. To do this, under MAMP in your main menu click on Preferences and then the Web Server tab. You should see the Document Root pointing to your htdocs folder. Click on the folder with the three dots and select your public folder inside Craft.

Step 6: Install Craft! #

Finally! Craft should be up and running and you should be able to access it via http://localhost:8888/ in your favorite browser. If you see a Craft based message titled Service Unavailable, don't worry that's good. That means craft is setup correctly.

If you visit http://localhost:8888/admin it will walk you through the install process, requiring you to setup a username, password and a few other settings.


After you walk though the install process, that's it!

Welcome to the wonderful world of Craft. It's an amazing platform.



Want great tutorials like this in your inbox?

Sign up for our newsletter!

Click to subscribe

Already working with Craft?

Checkout these awesome plugins!