Its often useful to run a local install of WordPress for development and testing. If you’re making changes to a theme or plug-in its a good idea not to work on the live site unless you can live with it if you break something. I usually work on sites locally before I launch them this way as well as its just faster not having to deal with FTP. You can work locally on your computer and technically you don’t need an internet connection. This can be nice if you’re working on projects while traveling as well. So lets see how to install WordPress on a Mac.
And for the record you can do this same thing on Windows computers as well – I’ll explain the difference below.
How This Works
WordPress is written in PHP as a content management application. It is designed to run on a web server such as Apache with PHP and MySQL installed properly. There are a number of ways you can do this on your Mac, as the OS is already running a web server you can use. In the old days this required some knowledge of terminal shell commands to get this working. Now I just use MAMP because its easy.
Typically a web server is made of some kind of “stack” as they say in the business. Developers refer to their setup as a stack much like a truck driver has his rig or a guitar player has his axe. A stack is a combination of software that makes it possible to run the website. A common “stack” is a LAMP stack. The acronym implies Linux, Apache, MySQL and PHP. Get your LAMP stack rolling and you’re ready to host a website.
Using MAMP to Install WordPress On A Mac
There are two apps that simulate this on your computer. MAMP for Mac and WAMP for Windows. Get it? Instead of Linux, there’s other flavors.
So if you’re on a Mac, go download, install and launch MAMP
If you’re on Windows, you want WAMP
MAMP or WAMP basically starts a web server locally on your computer.
You’ll need to know where all the web files will live so you can develop locally. On the Mac, the web server files are in Applications » MAMP » htdocs
On Windows you’ll need to double check on the WAMP site, but on Windows 7 they are in the following directories:
32 Bit | C Drive » Program Files » wamp » www
64 Bit | C Drive » Program Files (x86) » wamp » www
Once running, you go to your web browser and go to http://localhost:8888 on a Mac or just http://localhost on Windows to access the root directory of your web server. This is how you see the files you’re working on – its not online but lives on your local drive. This is how you see it in the browser.
Install WordPress
1) Download WordPress
2) Open Applications » MAMP « htdocs and create a new folder for your project – name it something useful
3) Copy the files from WordPress into this folder
4) On the Mac, when you launch MAMP you will get the start window in the browser. Go over to phpMyAdmin and create a database for your WordPress install.
5) In the WordPress project, rename wp-config-sample.php to wp-config.php
6) Fill in the fields to define the DB_NAME, DB_USER, DB_PASSWORD AND DB_HOST variables. The DB_NAME should be the database you created in step 4. The user is ‘root’ and the password is ‘root’. Make sure DB_HOST is localhost
7) Go to http://localhost:8888 in your browser and you should see your project in the list.
8) Open your project and WordPress should prompt you for the set up
That’s it!
I've been working with WordPress since it came out back in 2003 on various design and photography sites that I've had over the years. Check out my Google+ Profile |