14 Mar 2011, 1:00am
Programming:
by

13 comments

Running WordPress on Mac OS X with XAMPP

Experimenting on the theme, layout and widgets on a live WordPress blog is never a great idea as there is always the risk of not being able to roll back to your previous layout and widget configuration.  A lower risk way to experiment is to host and run a copy of your WordPress blog locally on your Mac, this way you can hack away with zero risk to your live blog.  The XAMPP bundle makes this very easy to setup:
  1. Download XAMPP for Mac OS X from http://www.apachefriends.org/en/xampp.html.
  2. Open the xampp dmg file and copy xampp into the applications folder.
  3. Run the xampp control app and start apache & mysql.
  4. Using your browser, go to http://localhost/xampp/splash.php
  5. Select your language then click phpMyAdmin.
  6. Create a database called ‘wordpress’ using ‘utf8_unicode_ci’ collation.
  7. Download WordPress from http://wordpress.org/download/.
  8. Unzip WordPress into /Applications/XAMPP/htdocs/.
  9. Copy the following details into your wp-config file, and save it as wp-config.php These are the exact details you need for Xampp to work because the default user in phpmyadmin is called ‘root’ and there is no password:
    1. DB_NAME is ‘wordpress’.
    2. DB_USER is ‘root’.
    3. DB_PASSWORD is ”.
    4. DB_HOST is ‘localhost’.
  10. In your browser, go to http://localhost/wordpress/wp-admin/install.php to install WordPress.
  11. Once WordPress installation is complete go to http://localhost/wordpress/ to verify the installation.
  12. To get automatic updates of WordPress and installation/updates of plugins and widgets working do the following:
    1. Make a note of your username e.g. ‘Daniel’.
    2. Open /Applications/XAMPP/etc/httpd.conf as root/admin e.g. “sudo open -e ‘/Applications/XAMPP/etc/httpd.conf’” from terminal.
    3. Find the following lines:
      User nobody
      Group admin
    4. Change the lines to the following:
      User <Your Username>
      Group staf f
    5. Save the file.
  13. Restart XAMPP and visit http://localhost/wordpress/ you should now have a fully functional WordPress installation you can experiment on without effecting your live blog.

The next step is to mimic the configuration of the live blog on the test blog by:

  1. Importing the posts and comments from the live blog.
  2. Installing the same theme, widgets and plugins.
  3. Configuring the theme, widgets and plugins.

You can now start hacking away on your test blog without worrying about breaking your live site!

Thanks for the awesome instructions, I was able to setup XAMPP on the Mac and install WordPress. However when I get to step 12 and try to make the changes to the httpd.conf file I can’t save the changes. I followed your instructions, I’m singed on as SU and I have even changed the file permission on the entire XAMPP directory…any guidance would be greatly appreciated.

You can check what group your user account is in by running the command ‘groups’ in the terminal window. Perhaps your not in the ‘staff’ group?

21 Apr 2011, 8:18am
by Margo Chui


Hello,
I’m actually stuck at step 10. Instead of getting a page that’s helpful, I get an “Object not found” message.

Help?

Did step 6 (phpmyadmin) work for you? Or did it have errors too? If phpmyadmin worked then php is probably okay.

Next thing to check is that the ‘/Applications/XAMPP/htdocs/wordpress’ directory created in step eight is present. And that it has a subdirectory called ‘wp-admin’ with a file called ‘install.php’ which is what your calling step ten.

Hi Daniel, thanks for posting this guide- it seems easy enough for a beginner like myself to follow. However, could you please clarify step #6? I don’t know what ‘utf8_unicode_ci collation’ means. Thank you again!

-Paula

Hello Paula,

There should be a drop down menu labeled ‘collation’ beside the text box for entering the new databases name. Set that option to ‘utf8_unicode_ci’.

-Daniel

This is very clear and concise, and helped me solve the auto-update issue, thanks!

I’m trying to set up my local network as a development environment, hosting Xampp on my MacPro but I’d like to have full access from my laptop too. I’m able to see the WordPress site from the laptop using http://(macpro ip address)/wordpress/ but the template does not load, it’s showing unstyled pages, as if the css is missing. Links revert to “localhost” as well.

Any tips on viewing a Xampp installation from a different computer? I’ve moved from Mamp to Xampp for this purpose.

Found it! The trick is to change WordPress >General Settings, both WordPress address and Site address to your host computer IP address. By default it says “localhost” but for computers on the network to see it, it must be IP address.

Hi, thanks for making this so simple. Been searching a while for a solution on this. Just started working on Mac, but have been using XAMPP on windows for a long time. So, on a Mac it was a bit different.

Thanks. Bookmarking :)

Hi Daniel. Good article on how XAMPP. I’m pretty big on it myself. You might like my twist on it as I’ve tossed in an ‘easy’ wizard to create friendly “fake” domain names for working on more then one site (and who doesn’t these days). It also features an intelligent copy feature just for WordPress (it scrubs your database posts, pages for re-mapping to a new domain). Check it out!

http://serverpress.com

Oh, and the aforementioned features are free.

14 Dec 2011, 10:52pm
by carolyn greco


I didn’t try this yet, but about to…..do you then know how to export that file onto network solutions?

I’m not sure what you mean by ‘network solutions’.

[...] running. There are a variety of ways to do this, but I use the approach of installing XAMPP. Here’s a tutorial on that. Follow the rabbit trail to configure Apache to look to your Sites directory, as I have, or make [...]

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>