Setting up WordPress on your local machine without using MAMP

by Andy Boyle.

Grumpy Tiberius isn't good at installing WordPress.

I’ve decided to retake the plunge and attempt to do some WordPress development for a friend’s website. Because I hate myself, apparently. My coworker and tall-person Ryan Nagle helped walk me through setting it up on my local machine without using MAMP. Because we’re ballers, shotcallers with 15-inch MacBook Pros.

This may be missing a few things, but it’s based on the notes I took when we were figuring things out. It’s meant for those running on Apple OSX, but I bet some of this will work for Linux-y things. Sorry, Windows people. Use xampp or whatever. First, download MySQL. I would suggest using Homebrew. Then download WordPress and install it where you put your code. For me, I put it in a folder called “sites” in my user’s directory under the directory “Code,” which is where I keep all of my projects. So I put it here: “/Users/andymboyle/code/sites”

Then let’s edit your /etc/hosts file. I use vim, so you’ll see my commands as such:

sudo vim /etc/hosts

On the bottom, add this (notice the single space): test.dev

Next edit the following:


Make it look like this, putting the path to where you installed your WordPress components after DocumentRoot and Directory:

DocumentRoot /Users/andymboyle/code/sites
ServerName test.dev
<Directory "/Users/andymboyle/code/sites">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all

Then you’ll need to edit your /etc/apache2/httpd.conf file. First, uncomment (Delete the # in front of it):

Include /private/etc/apache2/extra/httpd-vhosts.conf

Then make sure this is uncommented:

LoadModule php5_module libexec/apache2/libphp5.so

You’ll need to restart apache using the following command:

sudo apachectl restart

And now you’ll need to make your mysql server start:

mysql.server start

My notes are a bit fuzzy on the next things to do, but basically you need to add a root user and then give that user a password. As we’re running this locally, you can just make the user “root” and the password “root” as well. But I think the command to create a new user and give it a password was:

mysqladmin -u root password root

If that worked, next you need to log into into the MySQL prompt. When it asks you for a password, you will either use “root” (no quotes) or one that you added (way to not follow my instructions, you fancypants person):

mysql -uroot -p

You’re now in the MySQL prompt. You can do all sorts of fancy SQL things here, but what we’ll want to do is create a database for your new project.

create database wordpress_project;

It should say a database was created. Next, quit from the MySQL prompt:


Now go to wherever you installed WordPress (in my case, it’s in code/sites) and edit the wp-config.php file. You’ll need to change the follow parts to reflect your database name, your database user, the database user password and the database host. So make it look like this:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress_project');

/** MySQL database username */
define('DB_USER', 'root');

/** MySQL database password */
define('DB_PASSWORD', 'root');

/** MySQL hostname */
define('DB_HOST', '');

Now in your browser go to http://test.dev and you should see the standard wordpress install configuration. Enter your information, and voila, as long as your MySQL is running — mysql.server start — you should have WordPress running locally! Good job! You deserve a cookie.