One of the first things I wanted to do when I first got my MacBook was to install WordPress locally to use it as a development sandbox.
Even after following the tutorial at WP Candy I couldn’t get WordPress to work perfectly on the Mac. I uninstalled MAMP and tried using XAMPP, which I had used successfully on my PC. I had the same problem with both. First, you are not alone. (I was prompted to write this post when an EXPERIENCED developer friend had problems configuring WordPress properly on his brand new MacBook Air.)
After several futile Google searches and digging through the forums (http://wordpress.org/support/) I came up with this solution.
- WordPress asks for an FTP password when trying to update a plugin. It wouldn’t take my login password, so I reverted to doing a manual update. It worked, but it’s not what we want.
- If you try to update your permalinks, WordPress chokes while trying tocreate an .htdocs file. It complains about not having permissions to write to the file:
Here is how I fixed the problem. I used the terminal to do this (I worked as a Unix Sysadmin for several years). (If there is enough feedback I might do a follow-up on doing it using the GUI an a mouse.)
1. Find the directory where the problem lives:
$ cd /Applications/XAMPP/xamppfiles
2. Check the permissions and ownership on the htdocs folder:
$ ls -l
3. Find the username that your Mac knows you as. In my case it’s icet. I’ll use myuser for this example. Change the user and group of the folder. One command will do it; you will probably need to use sudo.
$ sudo chown -R myuser:staff htdocs
We’re getting closer but Apache still can’t write to the htdocs folder. We need to tell XAMPP to run Apache as someone else
5. Change to the directory where the configuration file lives:
$ cd /Applications/XAMPP/xamppfiles/etc/
6. Make a backup of the configuration file, then change permissions of the configuration file so you can edit it:
$ sudo cp httpd.conf httpd.conf.bak
$ sudo chmod 777 httpd.conf
7. Edit the User and Group lines in the httpd.conf file. I use vim because I’m already at the command line. The Mac’s built-in TextEdit application will work too.
$ sudo vi httpd.conf
7.1. Find the User and Group lines
# # User/Group: The name (or #number) of the user/group to run httpd as. # It is usually good practice to create a dedicated user and group for # running httpd, as with most system services. # User daemon Group daemon
7.2 and change them so it looks like this (replace icet with your username from step 3):
# # User/Group: The name (or #number) of the user/group to run httpd as. # It is usually good practice to create a dedicated user and group for # running httpd, as with most system services. # # User daemon # Group daemon User myuser Group staff
8. Stop and restart XAMPP
That should do it. You have given Apache the ability to write into the WordPress directory. It has worked fine for me for months.
Don’t do this on a production server! It probably introduces several security holes. Find a qualified server expert.