• 20 Dec




    Ready for some WordPress development on your Mac? First, you need to be running Apache, MySQL, and PHP.

    Although Mac OS X comes with Apache and PHP, you don’t want Apple’s automatic software update to break your development environment by changing your working versions of PHP and Apache. Plus, do you really want to spend time tweaking MySQL?

    In this guide, I will show you how to quickly install and configure a working WordPress environment including Apache, PHP, and MySql.

    1. Turn off Web Sharing

    First, you need to make sure the Mac OS X installation of Apache is not running. Navigate into your System Settings and check the “Sharing” settings. You want to turn off “Web Sharing” if it is currently enabled.

    2. Use MAMP

    MAMP is a free and ready-to-go install of Apache, MySQL, and PHP for Mac OS X. It is developed by Living-e. They also have a “Pro” version at additional expense. One of the great things about MAMP is that it includes almost every PHP option pre-installed and enabled. As a bonus, it comes with phpMyAdmin to help you work with databases quickly. To get MAMP, open up your web browser and go to http://www.mamp.info/en/download.html. Download MAMP, mount it, and then drag the MAMP folder into your Applications folder. You can safely ignore the “MAMP Pro” folder.

    3. Configure MAMP

    Go into the MAMP folder and then open the MAMP icon.


    The status lights will tell you if Apache and MySQL are running. If the lights are red, click “Start Servers”. Next, modify the ports for Apache and MySQL by selecting “Preferences” and select “Set to default Apache and MySQL ports.” You should end up with port 80 for Apache and port 3306 for MySQL. Next, click on the Apache section and change the Document Root to a location that you can quickly access. All your websites will reside in this location, so you want to pick something that you can navigate into easily. I like to use a root folder called “webspace” that I created in the Finder.

    4. Make a Database for WordPress

    WordPress requires a MySQL database to store posts and settings. You already have MySQL running, but you need to create a separate database for each WordPress website that you develop on your Mac. From the main MAMP menu, click on “Open start page.” Your web browser should pop open up to a “Welcome to MAMP” page.

    Next, click on “phpMyAdmin” to launch the phpMyAdmin web application. Look for the section entitled “Create new database” and name your database. As an example, enter “wp-superblog” and click “Create” to make a database.

    5. Make a folder for your website

    Within your “webspace” folder, make a new folder with the name of the website that you will be developing. As an example, make a folder called “super-blog” to correspond to the database you made.

    6. Install WordPress

    The easiest way to download WordPress is to point your web browser to http://www.wordpress.org/latest.zip Unzip the WordPress package and copy everything in the WordPress folder into your “super-blog” folder.

    7. Configure WordPress

    Navigate into your “super-blog” folder and locate a file called “wp-config-sample.php”. Open that file and change both the database username and password to “root” on lines 4 and 5. Next, make sure the name of your database (“wp-superblog” in our example) is shown on line 3. Save the changes you made to this file and then rename the file “wp-config.php”.

    8. Take a Test Drive

    Open up a web browser and navigate to “localhost”. You should see a folder for each website you are developing. In our example, you should see a folder named “super-blog”. If you click on it, you should instantly get to your new WordPress website.

    9. Turning MAMP on and off

    When you are not developing and testing a website, you may want to turn off Apache, PHP and MySQL. MAMP comes with a dashboard widget that will turn your environment on and off instantly. You can find the widget in the MAMP folder.

    Written exclusively for WDD by Derek Underwood, a professional web designer and software developer. You can read more about Derek and contact him at his website: http://www.derekunderwood.com


  • 47 Comments »

     
    #1
    Abulafio
    December 20th, 2008 at 07:08

    I already use MAMP, and I can say that it’s an amazing software, as well this is an great tutorial! Really a good job!

     
     
    #2
    DKumar M.
    December 20th, 2008 at 09:47

    Nice Article.

     
     
    #3
    Charles rice
    December 20th, 2008 at 14:21

    I so did this a few weeks ago. wish this post would have been around then to help. but being as how easy wordpress is to install i was going the long way to china by trying to get mySQL to work with the built in php. after a few days of beating my head against that wall i went the mamp route much easier and im a lot happier now. thanks for the great read

     
     
    #4
    Dean
    December 20th, 2008 at 15:42

    I use MAMP quite frequently. Combine MAMP with Coda to edit files on your local machine and upload quickly and easily to your server. It’s really great, you get an easy way to test everything before publishing, you have a local copy of your files if anything goes wrong and you get to really use all the power of Coda.

     
     
    #5
    Derek Underwood
    December 21st, 2008 at 14:31

    Yes, Coda is a great Mac application for working with web files. It also has a special mode for editing CSS.
    http://www.panic.com/coda/
    (I’ve completed another article for WDD about other text editing applications for Mac and Windows (and Linux) that help make designers more productive, so stay tuned!)

     
     
    #6
    John Nox
    December 21st, 2008 at 18:03

    a lot of time looking for online information about discounts on software, I am very interested to read this blog, because you want to learn about all software updates! thanks

     
     
    #7
    13blue
    December 21st, 2008 at 18:06

    What do I do when I get finished on the local machine? How do I get everything to the production host?

     
     
    #8
    Derek Underwood
    December 21st, 2008 at 22:00

    A comment was posted by 13blue asking about the next step – i.e. what to do when you are ready to make your development live and move it off your local machine? There are a few different ways to do this and details would best be left for another article. However, a summary would be:

    1. use the “export” function of phpMyAdmin to save the WordPress database you created

    2. copy everything from your local machine to your production server (in other words, do not bother installing WordPress from scratch onto the production server first)

    3. install phpMyAdmin to your production server if it is not already installed

    4. on your production server, use the “import” function of phpMyAdmin to recover the WordPress database you created on your local machine

    5. on your production server, use phpMyAdmin to change the WordPress database username and password

    6. on your production server, open the WordPress file “wp-config.php” and change the username and password per #5 above (or do this locally first, and then simply upload)

    7. assuming you have proper user rights set for all your directories on the production server, you should be good to go!

     
     
    #9
    insic
    December 22nd, 2008 at 01:45

    Nice article.

     
     
    #10
    Vance Dubberly
    December 22nd, 2008 at 23:04

    Why in gods name does MAMP exist? If you can’t install MySQL ( which is just a pkg ) and stop and start Apache ( which already exists on your computer ) you should be forced to ftp every little change you make to a server until you grow 2 brain cells. My god, this isn’t windows people. It’s easy, powerful, and open, at least put in a little effort.

     
     
    #11
    Derek Underwood
    December 22nd, 2008 at 23:45

    Sure, you can configure Apache, PHP and install MySQL manually on Mac OS X. Perhaps installing from source code (and compiling everything first) is the way to go if you want to learn more about OS X internals, BSD Unix, and systems administration.

    However, designers might find it productive to focus more time on creating and less time on system configuration – especially if their work is ultimately going to be hosted on another server anyways.

    Apple makes heavy use of open source technologies in OS X, including Apache, PHP and SQLlite. MAMP exists so that you can lock down your PHP/Apache/MySQL development environment without worrying about changes made by Apple’s Software Update. MAMP also allows you to tweak and experiment with PHP/Apache/MySQL settings without upsetting OS X’s configuration of its version of those same applications.

    You are right – Mac is not Windows, but that does not mean that designers using Windows are inferior. In fact until OS X, I would venture to say that Windows was superior in most every way. Even today, Windows users enjoy a much greater stable of software and accessories to choose from. Quark and Adobe makes software for both Mac and Windows – guess which sells more? As far as Windows, similar installs also exist to quickly deploy Apache/PHP/MySQL on Windows. You can search on the internet for “WAMP”. The same goes for Linux – search for “LAMP”.

     
     
    #12
    KodoTrade
    December 22nd, 2008 at 23:57

    This is yet another great aritcle…
    really appriciate posting this.

    Next step is the visitors.
    So are currently studying ALOT of Seo ;)

    Thx again :D

     
     
    #13
    Gavalian Web Design Studio
    December 23rd, 2008 at 04:30

    Great Article, Thanks. :)

     
     
    #14
    Vizou
    December 23rd, 2008 at 14:40

    Fantastically well done article; I use this setup myself. I’d add that designers using Coda might also enjoy CSSEdit which has a much better interface for editing CSS; I am hoping that Coda (which I also depend upon) will replicate some of CSSEdit’s great features… http://macrabbit.com

    In response to Mr. Dubberly, Apple’s version of Apache and MySQL have “default path” issues that make the MAMP setup much easier to start in for not-completely-geeks; at least they did in Tiger; now I’m in Leopard and having already done an install of MAMP, haven’t checked to see if they fixed this problem.

     
     
    #15
    Orange7
    December 24th, 2008 at 22:14

    Great article! Very easy to follow- happy to say it’s up and running now on my mac!!

     
     
    #16
    jay
    December 30th, 2008 at 20:03

    Thought you should note the link in your article in step 6 should be .org not .com http://wordpress.org/latest.zip.

     
     
    #17
    Walter
    December 30th, 2008 at 21:06

    Thanks Jay for pointing that out – problem fixed.

    Regards,

    Walter

     
     
    #18
    Jauhari
    December 31st, 2008 at 05:09

    For me, it’s more better using MacPorts ;)

     
     
    #19
    Derek Underwood
    December 31st, 2008 at 12:10

    MacPorts is fantastic and provides many open source projects ready to compile and install for Mac OS X. Thanks for mentioning it!

    However, designers without command line experience or Xcode experience may find it time consuming for setting up a basic web development environment. With MAMP, designers can switch between PHP 4 and 5 instantly (to better match their production server) and easily make a number of configuration changes to Apache, PHP and MySQL if necessary. If something goes wrong, MAMP resides in the Applications folder and can simply go to the Trash and be installed again.

     
     
    #20
    JustChris
    January 13th, 2009 at 02:13

    I’ve used this tool for weeks now and it’s a piece of cake to configure. Once running, it’s practically invisible. Too bad I would still have to learn to set up MySQL manually if I ever need to learn Ruby.

     
     
    #21
    Derek Underwood
    January 14th, 2009 at 13:46

    Ruby is a general programming language that is available for many operating systems. Ruby on Rails (RoR) is a Ruby framework that provides web-specific Ruby routines to assist developers in rapidly building high-quality web applications. I encourage everyone to check out Ruby and RoR. Similar to PHP, ASP, and ColdFusion, RoR can act like a scripting language that runs on the web server.

    Yes, Ruby on Rails (RoR) can work with MAMP. There are projects like “Locomotive” and others to quickly install RoR on your Mac. Meanwhile, you can continue to use the versions of Apache and MySQL that MAMP installs for you. In addition, you can continue to use MAMP’s installation of PHPMyAdmin to administer and tweak your database in conjunction with RoR.

    I don’t know if I would agree that you need to learn to use MySQL manually (from the command line) in order to learn Ruby or RoR. One of the great things about RoR is that it actually does a lot of the database work for you and gives you a chance to focus on the bigger aspects of your web application projects. Maybe a good topic for another MDN article?

     
     
    #22
    AudioVoyeur
    January 14th, 2009 at 14:53

    WOW Great Post!

    Thank you so much! Really Great tutorial for noobs (like me)!

    Thank you for taking the time!

    Kind Regards

     
     
    #23
    PlastisCS
    January 26th, 2009 at 13:23

    awesome guide – that you! worked perfectly
    i knew there must be an easy eay to do all this!
    cheers :)

     
     
    #24
    Gene R.
    January 27th, 2009 at 19:45

    great help thank you for posting this

     
     
    #25
    Marlow Quest
    January 28th, 2009 at 17:45

    really easy to follow and I had it all set in maybe 20 min
    thanks for instructions

     
     
    #26
    connie
    January 29th, 2009 at 02:49

    it is a great article, but when i click the index super-blog folder, it said “Error establishing a database connection”, does anyone can help me out? many thanks

     
     
    #27
    Derek Underwood
    January 29th, 2009 at 18:51

    * Connie

    Thanks for your comment.

    Sounds like you are getting a WordPress error that it can not access the database.

    Perhaps you have a mismatch between step #4 and step #7 above.

    In step #4, double check the name of the database that you created in PHPMyAdmin and make note of it.

    Then in step #7, double check your “wp-config.php” file. Make sure that DB_NAME is set to be the same name that you gave your database in step #4. If the names you set in #4 and #7 do not match, then WordPress will not be able to access the database. Also, make sure the DB_USER and DB_PASSWORD are those that you set in #4 (if you changed them). By default, MAMP sets both the MySQL database user and password to “root”.

    Hope that helps.

    Also, for those that misunderstood me, “superblog” and any database names or other names in the tutorial are just examples. You can name your website, blog, database, any names you wish and they do not have to match each other.

     
     
    #28
    Amy Stewart
    February 10th, 2009 at 20:21

    Thank you so much for this excellent tutorial! I was able to set it all up successfully, but now I can’t log into the wp-login page. I have no idea what to use for my Wordpress user name and password. Any ideas?

     
     
    #29
    Amy Stewart
    February 10th, 2009 at 20:36

    Okay, never mind. I must’ve breezed past the page the first time around that had my user name and password. Thanks!

     
     
    #30
    Anita
    March 2nd, 2009 at 04:28

    Hi,

    Thanks for that article. I’ve seen and read all of the MAMP / WordPress tutorials, and also the MAMP / Dreamweaver one. No one has been able to tell me if:
    The local host and the remote host are the same, wouldn’t I define remote as “none”, since it’s already defined in the local?

    My info is:

    **Local Info window:**
    Local Root folder: Macintosh HD:Applications:MAMP:htdocs: (do i leave off :wordpress?)
    http address: http://localhost:8888/wordpress/
    Link relative to document? or does it matter?

    **Remote Info window:**
    Access: Local/Network
    Remote folder: Macintosh HD:Applications:MAMP:htdocs:
    or is remote all “None” because it’s the same location as local?

    Testing Server is PHP…Local Area Network, Folder: Macintosh HD:Applications:MAMP:htdocs:
    URL Prefix is http://localhost:8888/wordpress/

    I have searched and searched online for info, but none was specific to this, thanks!

     
     
    #31
    Minnie
    March 2nd, 2009 at 11:59

    GREAT article. Thanks a million!

     
     
    #32
    jennifer Menke
    March 7th, 2009 at 23:36

    after spending most of the following instructions for doing this with the ports set at 8888 and 8889 and failing. I finally was able to install wordpress locally. then was presented with a log in screen and I can’t figure out what should go into username and password. Is it the name of the database? is password root? I clicked on “forgot password” and never got an email! so frustrated! any advice?

     
     
    #33
    jpg001
    March 28th, 2009 at 23:11

    hi, from France

    i use wordpresss 2.7.1 with mamp (php5, ports 80 and 3306)

    it’s ok, but i don’t see the little number when there is an update for a plugin and also the message under the plugin in the format list.

    But, i try One Click Plugin Updater plugin and now i see the little number and the message !!

    an other widget problem with forecast weather, i see the weather information sometimes. Perhaps it’s the same problem ? to receive informations from internet

    i would like to know why ?

    thank you

     
     
    #34
    Teodoro Lopez
    April 30th, 2009 at 23:23

    thank you, i just discovered this article and its great!

     
     
    #35
    Rhobust
    May 19th, 2009 at 12:34

    Fantastic tutorial – I was able to install MAMP without a hitch

    Many thanks

     
     
    #36
    Arkadaslik Muhabbet Sohbet
    June 11th, 2009 at 02:16

    Great Article, Thanks. :)

     
     
    #37
    Justyn McKay
    June 27th, 2009 at 17:32

    Hi,
    Awesome instructions… but, can’t get past step 4:

    Safari can’t connect to the server.
    Safari can’t open the page “http://localhost:80/MAMP/?language=English” because it could not connect to the server “localhost”.

    Have been trying so hard to access wordpress on my mac and would really love to succeed.
    Feeling very hopeful that you might be able to help me. Could you?
    Might my location have something to do with the problem? (I’m in New Zealand).

    Cheers,
    Justyn

     
     
    #38
    Bee
    July 23rd, 2009 at 02:04

    I loved your website tutorial. It solved the problem I was struggling with!!

     
     
    #39
    Mark
    July 28th, 2009 at 03:06

    I did this and everything was great until step 8. I tried to take a test drive and I could see other files in the folder but when I go to the folder with wordpress I get a text error in my browser saying “Error establishing a database connection.” Any help would be greatly appreciated.

     
     
    #40
    subcorpus
    August 9th, 2009 at 03:52

    very informative article …
    will try this now …
    thanks …

     
     
    #41
    mac wholesale
    November 30th, 2009 at 06:55

    Thank you for sharing.. I will be downloading this cool plug in.. sure it will be usefull for my sites..
    Thanks!

     
     
    #42
    Martin
    March 18th, 2010 at 05:46

    Thanks for the great walkthrough. I’ve got it working setting up a fresh install, but I’m trying to create a development environment for a live site. I’ve got the tables in the right place, and the _siteurl pointing to the right place, but I just get a blank screen. Any ideas?
    Thanks a bunch,
    Martin

     
     
    #43
    rjreynolds
    April 5th, 2010 at 02:44

    Really cool tutorial man!! I am up and running without a hitch. Just one important thing for those of you trying to set this up. Make sure that you have no spaces in the name of the folder that you are using to keep all the wordpress files in, or your browser will not be able to find the link to your page. great job!

     
     
    #44
    monitoring software
    April 16th, 2010 at 21:56

    fantastic tutorial. Thank you very much for making this free for us to use..

     
     
    #45
    mahasvin
    May 7th, 2010 at 16:43

    WHile MAMP/WP runs locally – its ok. When you point to machine from another host on local network I only see skeleton page in WP, no formatting at all. Looks like PHP output somehow does not reach the client browser. I am really stuck. How can I view local WP from another machine on LAN?

     
     
    #46
    pyemachine
    May 26th, 2010 at 05:04

    If you change the localhost address to an IP address in the settings, other networked machines should see it, however tread carefully as it can confuse the wordpress install.

     
     
    #47
    pyemachine
    May 26th, 2010 at 05:03

    Would love to see a follow up article on shifting a local MAMP wordpress install to a live website / host.

     
    Name (required)

    E-mail (required - never shown publicly)

    Web-site

    Your Comment (smaller size | larger size)

Home| Advertising| About| Contact

© 2010 All Rights Reserved