Installing WordPress Multisite with MAMP on OS X

So I’m finally able to purchase a Mac, and now I’m moving all of my design work over to it. I need to start working on developing a network of sites using WordPress 3. I’ve waited so long. Man, did I ever not know anything about WordPress. Here are some of the things I’ve learned in the past 9 hours of figuring out how to get WordPress 3 running on my Mac running Snow Leopard. Excuse me while I borrow others words (links will be posted to give where credit is due). My comments will be noted.

Step 1: Installing MAMP

Before you can install MAMP on your Mac, you’ll need to download it from the MAMP website. MAMP requires that your Mac is running Mac OS X 10.4.x or later.

Once the MAMP download completes, double-click on the MAMP disk image (it should be something like MAMP_MAMP_PRO_1.9.dmg), and you should get a MAMP window pop up. Drag the MAMP folder (not MAMP PRO) to the Applications folder.

Step 2: Basic MAMP Settings

Now that you’ve got MAMP installed on your system, launch MAMP.app (located at /Applications/MAMP/MAMP.app).

While you’re editing settings, MAMP might prompt you for an administrator password. This is required because MAMP needs to run two processes: mysqld (MySQL) and httpd (Apache), and depending on the settings you set for those processes, you may or may not need to input your password.

Once you open MAMP, click the Preferences button. Next, click over to “Ports.” The default MAMP ports are 8888 for Apache, and 8889 for MySQL. If you use this configuration, you shouldn’t get asked for your password, but you’d need to include the port number in the URL (localhost:8888). If you’d like to leave the port number out of the URL, change the Apache port to 80. The downside of using port 80 as your MAMP Apache port is that you’ll always be asked for your password. For multisite (network), you need to click “Set to default Apache and MySQL ports.” These port are 80 for Apache and 3306 for MySQL. Apache needs to be port 80 for network site to work.

On the PHP tab, you can select either PHP version 5.2.13, or PHP version 5.3.2. This generally won’t effect WordPress, unless you’re using a plugin that requires PHP 5.

Lastly, on the Apache tab, you’ll need to set a document root. This is where all of your files are going to be for your local web server. An example of a document root is /Users/USERNAME/Sites/wordpress/.

Once you’re done editing all of the settings, hit OK to save them.

Step 3: Starting MAMP Servers & Creating The Database

To start the MAMP Apache and MySQL servers, simply click “Start Servers” from the main MAMP screen. Your MAMP servers have now been started.

Once the MAMP servers start, the MAMP start page should open in your default web browser. If not, click on “Open start page” in the MAMP window. Once that’s open, select phpMyAdmin from the webpage.

Under “Create new database”, enter in a database name such as “wordpress”, and press “Create.”

Step 4: Downloading and Installing WordPress

  • Now it’s time to download WordPress. Once you’ve downloaded and unzipped the WordPress download, open up the “wordpress” folder. Click and drag all of the files from the wordpress folder to your MAMP document root (I use/Users/USERNAME/Sites/wordpress/).
  • Rename the wp-config-sample.php file to wp-config.php.
  • Open wp-config.php in a text editor and fill in your database details as follows: username is root and password is root. (STOP and read Step 4.1 before finishing the last bullet.)
  • Run the WordPress installation script by accessing localhost/wordpress/wp-admin/install.php in a web browser.

Once that’s complete, enter a blog name and email address, and you’re ready to use WordPress on your Mac. (steps 1-4 link and bullets link)

Step 4.1: Edit host file and httpd.conf

To create a simi-real virtual environment, edit your host file. Add mycoolsitename.dev or any name you like next to localhost. (e.i. 127.0.0.1   localhost mycoolsitename.dev)

  1. Open the Terminal.app. Either by start typing Terminal on the Spotlight, or by going into Applications/Utilities/Terminal.
  2. Open the hosts file. Open the hosts by typing on the Terminal that you have just opened: $ sudo nano /private/etc/hosts Type your user password when prompted.
  3. Edit the hosts file. The hosts file contains some comments (lines starting with the # symbol), as well as some default hostname mappings (e.g. 127.0.0.1 — localhost). Simply append your new mappings underneath the default ones or edit one of the default values. You can navigate the file using the arrow keys.
  4. Save the hosts file. When done editing the hosts file, press control-o to save the file. Press enter on the filename prompt, and control-x to exit the editor.
  5. Flush the DNS cache. On Leopard you can issue a simple Terminal command to flush the DNS cache, and have your host file changes to take immediate effect: $ dscacheutil -flushcache

(numbered items link)

Now edit your httpd.conf file.

Put these lines at the bottom of the httpd.conf file (located at Applications/MAMP/conf/apache/httpd.conf)

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot “/Users[Your User Name]/Sites/”
ServerName localhost
VirtualHost>

<VirtualHost *:80>
DocumentRoot “/Users/[Your User Name]/Sites/wordpress”
AllowOverride All
ServerName mycoolsitename.dev
</VirtualHost>

Substitute “[Your User Name]” with your Username. After that you have to reboot or type “lookupd -flushcache” in the Terminal to make these changes take effect. Make sure you set MAMP’s ports to the default Apache and MySQL ports. Click the “Set to default Apache and MySQL ports” in Preferences/Ports.

(httpd.conf code link)

You can try and skip Step 4.1, but I pretty sure you need it.

Step 5: Create Network

See here and begin at step 3. I will say that everything before step 3 is good to read, but you will start the network creation at step 3. (I think step 5: enabling the network is where I messed up bad.) Because your local copy of WordPress is not going to have .htaccess you will need to create it exactly where it says (e.i. /Users/[Your User Name]/Site/wordpress). The easiest way to create a .htaccess is through an ftp program like fireftp (at least that’s what I did). Create a file named “htaccess,” open it in your text editor, and paste the code that needs to be added from step 5; enabling the network. Save and close the file. Then, use your ftp program to change the name from “htaccess” to “.htaccess.” Make sure your .htaccess is in the correct folder/directory. After completing the steps from the link you should be ready to use your new multisite blog.

If this doesn’t help anyone, I know it will help me.

Advertisements
  1. Grazie 😉

    • wei
    • December 17th, 2010

    This definitely helps. Thanks for posting!

    • Daitya
    • April 6th, 2011

    Many thanks for this. Other tutorials have not spelled it out so clearly.

    • brussisch
    • May 2nd, 2011

    Hi, I’ve successfully set up the blog network. Could you also describe how to set up another blog in this network!? Unfortunately the blog which I created is not working respectivly the subsite won’t be created in my normal Blog Network (not locally) the subblog shows up with the standard theme. Thank you !

    • brussisch
    • May 2nd, 2011

    The error message

    The requested URL /wp-admin/ was not found on this server.

  2. Thanks so much for this! This helped a lot. For what it’s worth, I was trying to “clone” an existing multisite setup locally with MAMP, and I found I had to do a clean, empty WordPress install and enable multisite first and then import all my added database tables and copy all the files and all that kind of cruft.

      • Jeremy
      • August 10th, 2011

      Thanks for the comment and info.

  3. FYI, for people running Leopard or newer:

    Instead of “lookupd -flushcache”

    use “dscacheutil -flushcache”

      • Jeremy
      • November 21st, 2011

      Thanks for the addition/correction!

    • gESBENst
    • January 5th, 2012

    I’ve tried following your guide but as soon as i edit the httpd.conf the MAMP apache server stops working! Any ideas?

      • stefan
      • January 17th, 2012

      Same problem for me, anyone knows why? As soon as i delete the part that i added it will work again. So there must be something with those lines of code that isn’t right. Please help us

      NameVirtualHost *:80

      DocumentRoot “/Users[Your User Name]/Sites/”
      ServerName localhost
      VirtualHost>

      DocumentRoot “/Users/[Your User Name]/Sites/wordpress”
      AllowOverride All
      ServerName mycoolsitename.dev

        • Jeremy
        • February 12th, 2012

        See the track back by Kendra Martin. It should help. Thanks for the comment. Sorry, about the wait.

      • Jeremy
      • February 12th, 2012

      See the track back by Kendra Martin. It should help. Thanks for the comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: