I happened upon an interesting problem today whilst setting up WordPress 3.3.2 on MAMP. Essentially WordPress plays nicely with MAMP so long as you don’t want to switch on the Network feature that has been rolled in to the WordPress core since version 3.0 (it was previously available as WordPress MU (Multi User).
The problem is a result of WordPress Network’s inability to handle a host name with a specified port number. By default, MAMP uses port 8888 and 8889 for Apache and MySQL respectively, resulting in the host name http://localhost:8888 which WordPress Network won’t accept (the setup discussed here fails when using a host name that has a port number appended to it). However, with a few simple config changes to MAMP and and some very minor tinkering on the command line, you can overcome this problem.
Here’s how I got round the problem and got my WordPress Network working nicely on my local Mac. For the record, I’m using OS X 10.6.8 and MAMP version which includes PHP version and MySQL version. It’s also worth noting that, as far as my research could see, it is impossible to setup WordPress network in its sub-domain configuration on MAMP so the only option is to set it up in its sub-directory configuration. This wasn’t an issue for me as I need just this type of configuration.
Switch off OS X’s built in Apache web server.
Head in to System Prefs and make sure that Web Sharing is switched off. Otherwise OS X’s built in Apache server will get in the way of MAMP’s.
Download and install MAMP
No need for the Pro version, just the regular version of MAMP is all you’ll need. More info and download link here.
Firstly, set MAMP’s Apache document root to the proposed root of your local WP install. This is likely to be something like this:
Now set MAMP’s Apache and MySQL ports to web server defaults (80 and 3306 respectively). This will cause MAMP to request your OS X admin password whenever you start your MAMP server but if you’re savvy enough to be setting up a local web server, you can probably be trusted with an OS X administrator account!
Edit your hosts file
Open a Terminal window and type:
sudo vi /etc/hosts
This opens the hosts config file in the vi text editor. At the bottom of the file, you’ll need to add the following line:
127.0.0.1 domainalias.co.uk (choose whatever you want for domainalias.co.uk, I used imagespa.co.uk)
This basically means that from now on when you type domainalias.co.uk in to your browser it will actually point to the IP address of your local computer – the localhost.
If you’re unsure of how to use vi, take a look at this very helpful guide.
If the MAMP servers are still running, stop them and then quit the application. Ensure that the changes you made to /etc/hosts have been saved and exit your Terminal session. Probably best to restart your browser now as well. If you’re happy to do so, you might also do well to clear the browser cache as well. You can now restart MAMP and your browser. To check that everything is working as expected, create a really basic HTML file and save it in the folder that you specified as MAMP’s Apache root. Save the file as something like
test.html and then visit
http://mydomainalias.co.uk/test.html in your browser. If everything is ok, the file should render correctly and the host name in your browser address bar shouldn’t append a port number and certainly shouldn’t revert to
You can now download and install WordPress as normal using mynewdomainalias.co.uk as the WordPress Address (URL) and Site Address (URL) fields within WP’s ‘Settings’ menu. You can create the WordPress database using MAMP’s built-in version of phpMyAdmin. You’ll find full instructions for setting up WordPress locally on MAMP here. Don’t forget that just like our
test.html file, WordPress needs to be installed in the folder that you specified when you configured MAMP.
Setup WordPress Network
You should now have a WordPress 3 install working nicely available at
http://mydomainalias.co.uk with the WordPress admin available at
You can now continue with the WordPress Network setup using the Codex instructions found here.