After I created the video tutorial Install WordPress on a Localhost I started receiving a ton of emails from people using Macs.
In this article I’ll show you exactly how to Install WordPress on Mac. You need to follow the instructions I covered in this tutorial Install WordPress.
Then you will need to do the following:
It sounds like a lot, but I’ve included everything you need below so you can just cut and paste.
Mac httpd.conf File and WordPress
The httpd.conf file is located in the following directory: /opt/local/apache2/conf/httpd.conf
You need to open it in a program like TextEdit or my favorite free text editor called TextWrangler. If you downloaded Text Wrangler you can open the file by clicking File – Open File By Name. Then paste in the directory above.
Now that you have the file look for the following
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be “All”, “None”, or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
AllowOverride needs to be set to All like I have it set above. Save the file.
Make .htaccess File for Mac
Now create a file called .htaccess and paste the following in it:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule># END WordPress
# Options +FollowSymlinks
# RewriteEngine on
# rewritecond %{http_host} ^localhost [nc]
# rewriterule ^(.*)$ http://localhost/$1 [r=301,nc]# protect wpconfig.php
<files wp-config.php>
order allow,deny
deny from all
</files>Options +ExecCGI
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
Save this file in the directory you have created WordPress in. For me that is /Library/WebServer/Documents/wordpress/.htaccess
Now open the Terminal program, find the above file and enter the following: chmod 755 .htaccess This will give WordPress permission to make the changes it needs to make.
Setup Mac Config File for WordPress
Everybody has a Apache config file that has the same name as the user. So for example my config file is named derekbanas.conf
This file is located in the directory /private/etc/apache2/users/yourname.conf
Open that file in a text editor and make it look like this:
<Directory “/Users/derekbanas/Sites/”>
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Save it and just one step left!
Set WordPress Permalinks for Localhost
Now open up your WordPress dashboard in a browser. In your left sidebar under settings click on Permalinks. Click in the radio button next to the words Custom Structure and paste in the following:
/index.php/%postname%/
Click save changes and your done. Everything should function pretty much in exactly the same way as if you were on a hosting server.
If you have any questions or comments leave them below. If you would like me to create a tutorial for you leave those requests below as well.
Till Next Time
Think Tank
Thanks for the tutorial! My httpd.conf is located in /private/etc/apache2/, though, while /opt/local/ doesn’t even exist. What can I do to get permalinks to work?
Under settings in WordPress click Permalinks. Then click in the radio button named Custom Structure and enter the following /index.php/%postname%/
That should fix it