Developing WordPress Locally With MAMP

Advertisement

Local development refers to the process of building a website or Web application from the comfort of a virtual server, and not needing to be connected to the Internet in order to run PHP and MySQL or even to test a contact form. One of the most annoying parts of development, at least for me, is the constant cycle of edit, save, upload and refresh, which, depending on bandwidth and traffic, can turn a menial task into a nightmare.

With application platforms such as WordPress, which require a server back end to work, you would normally be constrained to develop on a live server, with the headaches that go along with that. MAMP1 and its Windows counterpart, WAMP2, are tools that allow you to locally develop applications that require a server on the back end.

The Local Server

MAMP, which stands for Macintosh, Apache, MySQL and PHP, is an application that allows you to install a local server-type environment in order to construct websites that would normally require you be on a live server somewhere. Ever opened a contact form in a browser from your desktop and wondered why it doesn’t work? The server-side components cannot operate without (in this case) the PHP back end, and this is where MAMP comes in. By installing this application, we can have a virtual server locally as our development sandbox. It is worth noting, from a portability standpoint, that this component can be run only from your desktop environment and cannot3 be installed on a USB drive. With that all settled, let’s get to it.

In order to be able to work with MAMP, we must first obtain it. So, head over to the project page4 and download the disc image. Double-click to begin the installation, and you will be presented with a choice:

MAMP Installation Screen
MAMP and MAMP Pro are on the installation disc image.

Both MAMP and MAMP Pro come in the same download. You need to install only one, and for most scenarios, MAMP is more than adequate. The pro version costs $59.00 USD and offers more options, and you can compare the two versions for yourself5.

Drag the MAMP folder onto the “Application” shortcut, and the installation will be underway. Once it’s completed, feel free to eject the disc image. Open up your “Applications” folder, and locate the new MAMP directory. Inside you’ll find MAMP.app, so — you guessed it — open it up. The program should start right away and open up your default browser, pointing to the start page. Congratulations, you now have a local server!

Preferences

From the main MAMP app screen, you will notice a “Preferences” button. Feel free to click on it to view the few options available.

MAMP App Screen
The MAMP app.

1. Start/Stop

From here, you have the option to tell MAMP when to start and stop the servers. If you choose to not start the servers automatically, then you will need to explicitly tell them to run each time you open the app. You may also set your home page, which defaults to the MAMP start screen, giving you quick access to phpMyAdmin; but you may set it to something like a WordPress directory.

MAMP Start/Stop Screen
Configuring the server.

2. Ports

In the “Ports” tab, the default Apache port will usually be 8888, and the default MySQL port will be 8889. I, for one, do not change these because they do not interfere with any of my other settings and do not require me to enter my password every time I start and stop the servers. You must include the port number in your URL this way; so, it would be localhost:8888/. To avoid this, you could change the ports to what general Web servers operate on: ports 80 and 3306. This will allow your URL to simply be localhost/; but you will most likely need to enter your password when switching the servers on and off. Another factor to consider is whether you are installing WordPress “multisite”; if you are, then you are required to set the ports to the default Apache and SQL ports of 80 and 3306, respectively.

MAMP ports setup
Setting up MAMP ports.

3. PHP

The “PHP” tab allows you to choose which version of PHP to run in the set-up. It will default to 5.3, and I do not change this because most applications I run either require PHP 5.3 or do not care. Just know that this option is available if you need it to run something such as legacy software.

MAMP PHP setup
Setting up the MAMP PHP version.

4. Apache

The “Apache” tab is one that I like to mess with, to change the document root directory. The root is where all of your websites and directories will be stored and accessed by MAMP, and it defaults to /Applications/MAMP/htdocs, which I find annoying to get to. So, I change mine to my sites folder. From the MAMP app window, click on “Preferences,” then on “Apache.” You can click “Select” and then set the installation to use the location of your choice for your websites. Again, I set mine to the sites folder for easier access.

MAMP Apache setup
Setting up MAMP Apache.

Installing WordPress

Now it is time to install WordPress. Head to the WordPress website6 and download the latest version, 3.2 as of this writing. Unzip the folder, and then simply drag it to your sites folder, (or wherever you chose to set the document root for MAMP). WordPress requires PHP and MySQL to operate, which is why we needed MAMP to develop locally; so, we now need need to make a database. Fear not: it is simple!

Open the MAMP start page — you can access it via the button in the main app — and click on “phpMyAdmin” in the top menu. Creating a new database is as simple as typing a name in the field and hitting the “Create” button. You can see below that I am creating a new database aptly named “wordpress.” Once that’s done, feel free to close phpMyAdmin, and navigate to the WordPress directory in your document root.

Creating the Database
Simply type a name for the database, and hit “Create.”

Basic Configuration

Find the file named wp-config-sample.php, and open it in your favorite text editor. We have to configure a few settings. The default values for MAMP installations make this really easy to fill out, so follow the table below to see what to type where:

Variable Value
DB_NAME wordpress
DB_USER root
DB_PASSWORD root

Editing Variables
Change the values of the variables to match the table above.

You should not need to alter anything else in this file, at least for now. You could add in the unique keys and salts, but I recommend doing that once you move the website into production.

Save and close wp-config-sample.php. We’re nearly done. Rename this file to wp-config.php — removing the -sample — and we are ready to complete the installation. You should now be able to point your browser to http://localhost:8888/wordpress and see the WordPress installation screen. Enter in your basic data and install the app. You are now ready to log into the admin section and get going!

WordPress Install Screen
Enter your information… but choose a stronger password.

Permalinks

Always follow WordPress’ permalink structure. In order for you to get these “pretty URLs7,” Apache will need mod_rewrite to update your .htaccess file, so let’s make sure that is set up.

The file we have to edit is httpd.conf, and you can find it in Applications → MAMP → conf → apache → /. Open this file, and search for a line like this:

LoadModule rewrite_module modules/mod_rewrite.so

Note that a hash (#) may or may not be in front of it. The hash indicates a comment, and if you see it, you must remove it to allow the mod_rewrite module to load. If the line is not commented out, then congratulations: you are already done! Close the file, and permalinks should now work in your local installation.

The Final Countdown

By now, a local server set up with WordPress should be installed and running. The remaining steps are both short and crucial to sharing your creation with the Internet. All that remains is to transfer your local accomplishments to a global environment by moving both our WordPress files and our content. So, let’s finish this up!

Going Live

The time has finally arrived. So, how do you bring your WordPress creation to the live server? Well, we have two options.

Just Grab the Content

A sometimes simpler way, with only a few steps, is to just grab all of your content. This is easiest if WordPress is already installed and you just need to import your theme and content. To do this, head to the admin dashboard, to the “Tools” section in the sidebar. Click on “Export,” and choose “All content.” This will export a file that you can then import into your new installation.

WordPress Content Export
Exporting WordPress content.

You can now upload your WordPress theme files to the live location. Head to the “Tools” section of the dashboard again, and choose “Import.” Simply point to the file that you just exported, and bring in your content.

Bringing In Everything

I use this method if I have done everything locally from the ground up. I’ll upload my entire local WordPress directory (in this case, http://localhost:8888/wordpress) to the live server and then grab the database file and transfer that from local to live as well.

Because you could certainly build nearly the entire website in your development environment, bear in mind that WordPress uses absolute paths for URLs. So, every image and link will be prepended with http://localhost:8888/ (depending on your set-up). We need a way to alter this to fit the live website. We have a few options.

1. Export, Search and Replace

Using this method, we export our local database as a text file and run a “Find and replace” on the text to replace all occurrences of the localhost URL with the production URL.

WordPress Database Export8
Exporting the WordPress database (click image for full-size view).

Begin by opening phpMyAdmin and clicking on your WordPress database on the left. Click on the “Export” tab in the top menu, and be sure to choose “Select all” when choosing which tables to export. At the bottom, check the box to “Save as file,” and then hit “Go.” Open the resulting file in your favorite text editor, and simply run a “Find and replace” to replace all instances of http://localhost:8888/wordpress with http://www.YOUR_SITE_URL.com.

Save the edited file, and visit phpMyAdmin on your live server. Again, click on your WordPress database, and this time choose the “Import” option from the top menu, and browse for your newly edited file. Once it successfully imports, upload your WordPress directory to the live server. If WordPress is already installed, simply upload your theme, any plug-ins you have installed locally and the contents of your wp-content/uploads folder; or else, upload the entire local directory to your live website’s root. Once that’s uploaded, be sure you can log into wp-admin, and browse around to make sure everything made it in. Update your permalink’s structure to something friendlier, and you are off!

2. Using SQL Queries

A second way to alter URL paths is to first bring everything into the live server version, and then use a few SQL queries to find and replace the necessary strings. Open phpMyAdmin on your local server, and export the database, again making sure to select all tables and to save it as a file. Go to your live server, and import the .sql file that you just saved. In the top menu, click on the tab for “SQL,” whereupon you will see a text area. You will need to enter some query syntax; be sure to replace the URLs in these code fragments with the ones that pertain to your set-up — namely, the localhost’s path and the URL of your new live website.

SQL Query Screen9
Running SQL queries to update the URL paths (click image for full-size view).

Replacing WordPress’ base URL path:

UPDATE wp_options SET option_value = replace(option_value, 'http://localhost:8888/wordpress', 'http://www.YOUR_SITE_URL.com') WHERE option_name = 'home' OR option_name = 'siteurl';

Update the GUID that controls WordPress’ translating paths and post locations:

UPDATE wp_posts SET guid = REPLACE (guid, 'http://localhost:8888/wordpress', 'http://www.YOUR_SITE_URL.com');

Update the URL paths in the content:

UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://localhost:8888/wordpress', 'http://www.YOUR_SITE_URL.com');

Update the URLs in the meta data of posts, such as attachments:

UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'http://localhost:8888/wordpress','http://www.YOUR_SITE_URL.com');

Final Thoughts

We have managed to install MAMP to set up a local server sandbox10 to develop in, and we’ve configured and installed a WordPress platform to develop in, saving the need for purely online development tactics.

I hope this has given you some insight into setting up a local environment to work with WordPress. Keep in mind that this is just scratching the surface; WordPress is versatile. Now that we have this faster new way to develop, the next time we’ll get into some custom WordPress configurations.

Helpful Links

You may be interested in these related resources:

(al)

↑ Back to topShare on Twitter

Ryan is a front-end developer who believes in an enjoyable web for all and created BrowsingBetter. He loves WordPress, jQuery, learning new web skills, and short walks far from beaches. Check out his newest project TextMateUser and tweet with him @ryanolson.

  1. 1

    You could also use Bitnami’s pre-configured WordPress stack. They offer a virtual and cloud hosted version as well. I use them for starting/testing a number of applications.

    0
  2. 3

    Not sure if there is something similar for Mac, but I used to do the same process as above with XAMP until I found Instant WordPress. What a time saver!

    http://www.instantwp.com/

    0
    • 4

      I have used XAMPP on windows for over a year now. In addition, XAMPP has a portable version you can put on a USB – very useful.

      0
      • 5

        Xampp rulez! Portable version is really nice when you work on your home pc. There is no need to install services such as MySQL pernamently so they arent impact on your pc memory and performence.

        0
  3. 6

    I use this setup to develop and it’s great.

    One thing that always bugs me is installing plugins – does anyone know a foolproof way of getting rid of the ‘Enter your FTP server details’, or what I should actually put in there?

    0
    • 7

      I’ve only ever seen this on my live server – on any WordPress install on MAMP all plugins and themes simply download and install themselves by default – no FTP details required. Not much help I know, but it can be done!

      0
    • 8

      @Tommy In MAMP Pro, in the Server > General pane, under “Run Apache/MySQL server as a user” you should be able to select “yourname/yourname” from the dropdown select box. MAMP displays a security warning, but I think it’s worth switching to just for the sake of installing WP plugins. You can switch it back to “www/mysql” when you’re thru installing plugins. I hope this work-around works for you as it does for me.

      0
    • 10

      Hi Tommy!

      Add:
      define(‘FS_METHOD’,’direct’);

      To the bottom of your wp-config.php.

      0
  4. 11

    Question: What is the difference using WAMP vs XAMPP? I’ve been using XAMPP for a couple of years & it suits me fine…

    0
    • 12

      I’ve been using XAMPP as well, I haven’t encountered any problems with it, so I wouldn’t say that it is unstable in any way. The main difference between WAMP & XAMPP is the extra P, of course, which stands for Perl, XAMPP installs Perl as well, WAMP doesn’t.

      -1
    • 13

      Michael,

      I have never used XAMPP but a quick Google on it says a lot of people are like you, perfectly happy with it. Seems to be a smaller setup, and cross platform, however not quite as stable and secure as its WAMP and MAMP counterparts.

      Again, that was just a cursory search ;)

      0
      • 14

        You DO know that php and Apache are installed by default on OSX right? All you have to do is go into System Preferences->Sharing, and turn on Web Sharing.

        For MySQL, you can just download a DMG from the official website, and a preference pane, and you’re all set. There’s no reason to install ANOTHER copy.

        0
        • 15

          i was going to say the same thing. and if you really want PHPmyAdmin, like i do, then you can install it locally too, so, no point in getting MAMP. Although, MAMP does make it easier and quicker to set up a localhost for the people that dont know how to do the rest.

          0
        • 16

          PHP is installed and the process of activating the built in server is simple. However, PHP is not activated by default, and has to be turned on by the user by editing a hidden core file (you basically just have to uncomment the line that activates PHP). Simple, yes, but can be daunting by some people. You would also only have the option of testing with version 5.3.6 (in Lion anyway). But once it is set up it is very easy to use. MySQL installs easily, and I use MYSQL GUI Tools which set up easily as well. That’s what I use for all my local development with WordPress and such.

          0
        • 17

          I used the default install of PHP/MySQL/Apache on OSx, but the problem is that being a developer I can’t be bothered setting it up and having to research for problems if any are encountered.

          I use MAMP Pro, which is great as it has everything I need in one place for my Virtual Hosts, PHP Versions, PHPMyAdmin, dyndns & Postfix settings and other tools.

          I know it’s not hard to set up correctly, but I don’t want to have to go in and configure the web site by going into x files to amend the details. MAMP has the basics in one place and MAMP Pro has all the advanced parts in the same place too, like error logging and displaying, virtual host set up and such preferences.

          This is a great tool that is enjoyed by many front and back end web developers for the ease of use and setup. I know a few developers that are great back end developers but do not want to touch the inner workings of OS x. With MAMP/ MAMP Pro you can play around all you want & if you break it, you re-install it… Simple :)

          @Ryan: I am liking you’re browsingbetter & textmateuser sites. I have been using Netbeans recently as being an IDE, it gives me a one stop shop for everything. I was wondering if you knew what features where coming to TextMate 2 as I do still use this occasionally.

          0
          • 18

            Hey smilinmonki666 thanks for the comments,

            I have no info on what is coming in TM2, but I assure you as soon as I can squeeze some out I will post it :)

            0
        • 19

          Jasper Van Proeyen

          September 30, 2011 5:45 am

          Even a better reason to use the built-in PHP and MySQL on Mac OS X: once you get the hang of it you can make use of virtual domains (e.g. dev.www.smashingmagazine.com). If you have Windows installed via Parallels, you can make use of the same virtual domains there and test your websites in various versions of Internet Explorer (all locally and live) – and yeah, other browsers too ;-)

          0
          • 20

            You don’t have to use the built-in Apache+MySQL+PHP on the Mac in order to take advantage of virtual domains. I do this all the time with MAMP.

            You just have to edit your Hosts file to point your custom domain to the localhost.

            127.0.0.1 http://www.customdomain.dev

            Then add your virtual domain to the bottom of the httpd.conf file found inside of the MAMP installation.

            Works great, and you can still test with VMWare Fusion or Parallels by editing the hosts files on your Windows installations, which really comes in handy.

            0
          • 21

            Jasper Van Proeyen

            October 3, 2011 11:32 am

            I know, thanks! But AFAIK you can’t test them in Parallels then.

            0
  5. 22

    Good thorough article, bookmarked.

    0
  6. 24

    Nice post Ryan.

    I have a request thou.

    Dear Smashing Magazine! It would be nice if someone gave a nice article on how to work with MAMP, WordPress, etc. and Subversion working locally and uploading/updating your site on cloud/host/web etc.

    I think this would be a nice tutorial.

    0
    • 25

      Thanks Alex!

      I have never worked with Subversion before, perhaps I can look into writing one using Git…

      0
    • 28

      Hi Alex!

      I am actually in the process of writing up the exact article you need I think :) It basically describes creating a custom WordPress install using SVN alone (having all plugins version controlled as well and so on.)

      I was actually half way through writing this exact article when I saw it published so THANKS RYAN! :) Seriously though, awesome article, this is almost exactly how I do local tests if I’m not using version control.

      The only additional thing I do (I think it is mentioned in comments below) is that I use virtual hosts to enable roots like http://mytestsite/ instead of http://localhost/testsite/ This enables me to use htaccess rules and other things without subdirectories.

      0
    • 30

      I am currently writing a tutorial on setting up a Linux Box & OS x box with:
      Git
      BugZila
      MAMP/LAMP
      sFTP/SSH
      MySQL Sync between 2 servers

      plus some other toys….

      Git is easy to set up on OS x or any other OS for that matter, you just need to read up on it to really understand the concept so you get better usage from it. I prefer to SVN as it seems more stable. For a team of 5+ using SVN, we seem to have a few problems.

      0
  7. 31

    Wow, nice tutorial… Helpful if you are using wordpress and ur website is under construction, develop it locally n launch in a shot.
    :D

    0
  8. 32

    anyone know more about the guid field update?

    the codex seems to say NOT to change it, EVER:
    http://codex.wordpress.org/Changing_The_Site_URL#Important_GUID_Note

    0
    • 33

      Yes, I was thinking about that too. From what I understand, changing the GUID won’t ever break your site, it just has the potential to interfere with feed readers.

      Since you are only developing locally at this stage, posts will not have been aggregated by feed readers on the web and so there won’t be the issues outlined in that codex article.

      0
  9. 34

    I know this is completely preference, but because of the way WordPress relies on the fully qualified domain name I’ve found it easiest to simply edit your hosts file so that your computer resolves whatever domain name your developing for to your computer.

    If you open terminal you can type sudo vim /private/etc/hosts or as a textmate user I type mate /private/etc/hosts which opens the hosts file. Add 127.0.0.1 example.com – as long as you’ve got the site configured in your virtual hosts file, when you go to example.com it resolves local.

    So when you push your site up, it’s as simple as exporting/importing your database (Sequel Pro makes this even easier then PhpMyAdmin – but the tool you use is up to you), and copying your files to your server. You may need to change your database settings, but that would be it.

    0
    • 35

      Good point Jason, thanks for your input.

      As you said, definitely a preference as there is by no means only one way to do something. MAMP Pro also offers the ability to set up virtual hosts quite easily, which is something worth looking at as well, though beyond the scope of this tutorial. ;)

      0
    • 36

      If you’re uncomfortable editing your hosts file I find that VirtualHost from clickontyler http://clickontyler.com/virtualhostx/ works great on the Mac. As Jason says this means that you can use the final url locally for development so that you don’t have to search and replace the dev urls for the final urls in the WP database at launch time. btw there is also a version on the site that will run on Leopard.

      0
    • 37

      You can also manage your Apache files with TextMate via the Bundles menu….

      0
  10. 38

    A third way to update URLs in an SQL file is by using cat and sed, two command line utilities. To replace all occurrences of “yoursite.dev” with “yoursite.com,” use:

    cat /path/to/file.sql | sed ‘s/yoursite.dev/yoursite.com/g’ > path/to/file/new-file.sql

    The result, new-file.sql, is created in seconds with your URLs updated. Using this approach versus TextMate’s Find and Replace functionality saves time and hassle. No spinning beach ball.

    See the man pages for sed and cat for more details. Open up that command line!

    0
  11. 39

    This is a good setup for local dev but it is a lot of headache when moving from local to production. A better way to handle that is to use something like SVN or GIT.

    Then modify your hosts file and vhosts file so your local environment will match the remote environment. Then you can install your wordpress on the remote server and point your local machine to the remote database.

    Using this setup it is possible to develop locally and when your done push your changes up with SVN never having to touch FTP and never having to worry about changing your database once you set it up the first time on the remote server.

    0
  12. 40

    Thanks Ryan for your post. I use a similar set up with VirtualBox and Ubuntu server. My main issue is moving WP from the dev environment to the live server. Does anyone knows why on earth WP uses absolute paths for URLs and stores them in the DB? It drives me crazy! What’s the reason for it? I can’t believe that I have to run sql queries to clean up the mess and update the tables with the right URL. IMHO, it just seems a bad design to me.
    Anyhow, thanks for your clear step-by-step guide on how to fix this.

    0
  13. 41

    If I had 3 wordpress sites I was working on simultaneously can you develop multiple sites using the one MAMP configuration? I’m not quite clear.

    0
    • 42

      Hey Peter,

      Do you mean a WordPress Multisite setup? Or simply three different WordPress installs?

      0
    • 45

      You can use a local MAMP set up to run as many individual WordPress sites as you need. Simply configure a separate MySQL database for each, and set up a separate site for each.

      This is also true for mulitsite installs. However, as mentioned above, WordPress multisite is very dependent on domain names. With MAMP, you can either manually edit your hosts file, or pop the $50 for the Pro version which does it for you. I develop nearly everything locally, using the Pro version and by using the altered hosts file, the actual domains to which the sites will launch. This way there are no surprises when I deploy to production. I then can simply export/import the db, then prop over the files. If the database is set up locally with the same info as the production system, the wp-config info stays exactly the same and it is a fast and simple process.

      0
    • 46

      I never had problems working on several WordPress sites with MAMP. I just create a new database for each new site. Be aware though that all the sites have to be found by MAMP at the path you specify in Preferences/Apache. May it be users/you/all-sites/ so, under “all-sites” you will have:

      all-sites/wordpress-1/
      all-sites/wordpress-2/
      all-sites/wordpress-…/
      (hope is clear)

      Instead, I would really like to read more about Subversion with WordPress, and WordPress multisite with MAMP.

      Last thing, Ryan, why you open the config-sample.php? Isn’t WordPress 3.x providing a front end interface for setting this up, during the installation process? Maybe I’m missing something.

      By the way, thanks for the article :)
      Ciao!

      0
      • 47

        Hey Carlo,

        I would like to learn more about version control with WP too ;) So that is on my list to study. As for a front end set up interface, to be honest I do not know I am so used to doing it the config.php way!

        0
  14. 48

    Hey Ryan, thanks for your article. I would love hear something more about what is the upside/downside of using MAMP instead of a built in apache/php?

    I understand it’s a all in one package which makes the environment setup/usage a lot easier for a lots of people, but that’s not the answer I’m looking for :) So, why do you consider using MAMP better as native environment?

    0
  15. 49

    Ive been using MAMP for the past year. GREAT for testing locally. This article explains it all.

    0
  16. 50

    Hi. Unfortunately, Wamp is completely out of date (nothing since sept. 2010) and Xampp is not friendly at all. Personalty, I prefer EasyPHP (http://www.easyphp.org) : up to date (even with PHP 5.4.0 beta), it comes with modules like WordPress, Drupal, Joomla… (no need to follow the tutorial above you just need to run the module setup – 2 minutes and it’s done) and you can control everything (admin for alias, virtualhosts, php and apache configuration, Xdebug…).

    0
  17. 51

    Good article, personally I use MAMP for almost two years without any problem.

    0
  18. 52

    I’m going to drop this in here:

    Sometimes, because of certain situations, WordPress/MAMP can manage to misplace a .htaccess file, leading to certain directories (such as phpmyadmin) becoming inaccessible. Clearing the htdocs folder, or even reinstalling MAMP, won’t help.

    If this happens, check your root hard disk folder – often, the .htaccess file somehow ends up here.

    I just had this happen, so hopefully this comment will pop up if anyone has this happen.

    0
  19. 54

    The pro version costs $59? Looking at the feature set there are additional things but I just don’t think it has anything I’m dying to have. XAMPP is free and I cannot find a reason as to why you’d need anything more for running php, mysql, mail, ftp etc locally. Comes with phpMyAdmin, xDebug (windows version) etc.

    0
  20. 55

    Thanks for the roundup.
    I use the mysql search&replace method and noticed several widgets deleted when moving sites (WP 3.0 and greater). Did anyone else notice some issues with widgets after WP has moved?

    0
  21. 56

    What about WAMP !!? can we have an explanation about it !
    thanks.

    0
  22. 57

    nice article. i bookmark.

    0
  23. 58

    Thanks for the great article. Question: My sites folder is in my DropBox folder, so I can dev my sites on any of my local computers. The problem is that the WP database is different on each machine, so admin stuff I do isn’t there on the other machines.
    Is there a way to store the DB in DropBox, or in some shared folder? I tried to do this a while back, it involved a simlink I believe, but somehow it didn’t work. What do you recommend?
    Thanks again!

    0
    • 59

      That is a cool idea Ben, sadly I have never looked into such a setup. If I figure it out I will let you know and please do the same!

      0
    • 60

      Ben, you could host your database remotely (with your web host or your own server if you have a static public IP).

      0
    • 62

      I only develop from one machine at work, but I consistently need to share what I’m developing with others in the office. I have MAMP configured that my /users/MyUserName/sites is the root web directory for Apache, and I have MAMP configured to use port 80 instead of 8080. So, when I enable web sharing under Preferences -> Sharing, that directory is open to everyone on my local network (though I have to add my IP address and the domain name I’m developing for to their hosts file.

      As for database management, the way I prefer to do it is the free application Sequel Pro. It’s awesome, and you can configure it to work over SSH, so you’d connect to the other machine via SSH, then you’d essentially be working locally on the database.

      However, once the site is set up on the other computer, how much direct manipulation of the database is going on? As long as the site is allowed to connect to the DB (through localhost), and you can get to your site’s root folder, you’d be fine.

      0
      • 63

        Jason, to answer your question “However, once the site is set up on the other computer, how much direct manipulation of the database is going on?”, I think it’s a ton-we’re making pages/posts, adding plugins, etc. which all changes the wp database. I’ll check out Sequel Pro; sounds promising if a bit over my head, as SSH scares me :)

        0
    • 64

      Do you find the Dropbox / WordPress combo to work smoothly?
      I was going to try this and use a WP Candy’s sample WordPress content as a default database between machines. I don’t need to do much from the dashboard during development, so figure this will bode well as far as the database is concerned.
      Thoughts?

      0
  24. 65

    My preference for PHP development on mac is having a virtual machine (debian) with Zend server CE on it. Document root is then set to my Sites folder (which is shared to the guest OS). On top of that I have Komodo IDE and xdebug for easy debugging. Saves me hours.

    0
  25. 66

    Could you install this on a simple XP box and run a local server in your home or possibly a small business intranet site?
    I am unclear on how robust this actually is for day to day use vs. development and testing.

    Thanks…

    0
  26. 67

    Call me a sucker, but I went ahead and ponied up for MAMP Pro, but only because I’m likely to be working 3-4 sites at the same time and having the GUI lets me set up a new site in LESS THAN one minute. It handles the hosts file so I can have my local domains end in something very ‘original’ like “.x” (not .xxx though!).

    I also use Navicat for MySQL Lite (not ‘MySQL Lite’ but the ‘Lite’ version of the app) for quick, easy and (mostly) painless editing of the db (both locally and remotely – it supports SSH tunneling too, for those web hosts that won’t let you hit their db servers remotely).

    And on top of all that, I use a WordPress plugin called BackupBuddy to migrate sites (and to back them up, of course). Yes, it also costs actual money, but if you make a living building WordPress sites it will pay for itself the first time you use it (in time savings).

    Great article! Thanks for sharing. :-)

    0
  27. 68

    After reading this very well-written tutorial I had high hopes for trying out WAMP (currently WampServer2) but it hasn’t gone well for me.

    I followed all the steps up to setting up the database but I get “Error establishing a database connection” when I try to use it.

    As far as I can tell I’ve followed all the steps correctly, although WAMP and MAMP seem to differ in some significant ways so it’s hard to be sure. In particular, I’ve no idea how to check the Apache and MySQL port settings.

    I presume DB_USER and DB_PASSWORD should be ‘root’ as in your example but I’m not sure how to check that, either.

    I’ve tried to find help on the WAMP forums but they look like a waste of time. Most queries seem to get pounced on by people touting ‘how to’ guides which turn out to be useless, spammy, ad-ridden wastes of time.

    If anyone can suggest what the cause of my problem might be, or could suggest an alternative to WAMP, I’d be very grateful.

    0
  28. 70

    Nice tip, and if you use mamp pro the things will gonna be a little bit faster.

    0
  29. 71

    I’ve used MAMP & WordPress together in the past, however after switching the apache folder to a location within Dropbox, I’ve been unable to use WordPress for reasons I cannot begin to figure out. I’ve also tried reinstalling MAMP and starting from scratch, however, I just get a 404 error when trying to run the install.
    Anyone had a similar experience?

    0
  30. 72

    Is there anything else that might cause the permalinks not to work properly? I’ve followed the steps above and it works apart from the permalinks.

    If I set the permalink structure to ‘default’, I can view posts. But when I switch to one of the others I get a 404 error when I try to view a post.

    0
  31. 73

    Why use MAMP? Os X has apache and php reconfigured and installed, you just need to enable and there are tons of easy to follow guides there.

    0
  32. 74

    I’ve setup MAMP prior on my personal computer but am now having problems at work on OSx Lion.

    I’ve setup and loaded loaded everything including a doc in the root folder htdocs but I’m gettting a 404 page. Any ideas?

    0
  33. 75

    I first set up MAMP using a video tutorial on Lynda.com. It was done by Chris Coyer of css-tricks.com, he has another tutorial on his website doing the same thing. After a few times of doing it, it becomes second nature.

    0
  34. 76

    I have installed MAMP 2.0.5 on my iMac (OS X Lion) to use as a test and development platform for my WP blog site. I am having trouble sending emails from within WP, for they are being sent with a return address of “msheaver@michael-sheavers-imac.local”. This is causing them to be rejected by my ISP (Comcast) SMTP due to invalid sender domain, and understandably so.

    Where within WP can I set the mailer to use a correct domain name? It appears from digging around that this is set in wp-includes/class-phpmailer.php. It looks like it is coming from the LOCALHOST and LOCALDOMAIN global variables, or possibly the SERVER_NAME variable.

    I could manually make changes in this file, but want to know the proper place to set the outgoing so that future WP updates will not wipe this out. In other words, where is the proper place to define the outgoing email return address as “msheaver@michaelsheaver.com”?

    0
  35. 77

    Ryan, I just wanted to thank you for a great tutorial. To give others an idea of just how well written and easy to follow this is; read the comments. If 97% of the discussion is unintelligible you match my skill set and the tutorial will be just as easy for you to follow.

    0
  36. 78

    Hi Ryan,
    I followed your tuturial, twice. Once on my MacBook Air (works perfectly) and the second time on my iMac (both OSX Lion). The 2nd go round MAMP and WP both installed fine but my issue is that when I click the link that is my website name (in the admin bar of my WP dashboard) it doesn’t show my site at all. It gives me a page saying “Your Website. Its a snap to create and publish your own website from your Mac . . .”
    And yes Web Sharing is turned off.

    Any thoughts??

    And yes I am a first timer who just jumped in!

    0
  37. 79

    I’m a bit of a newbie to local servers etc…I have followed your instructions and those on the CODEX site in preparation to install wordpress….I cannot get the status of my MYSQL server to go green…..I’m running MAC OS X 10.7…..any help would be appreciated….when I look at the logs it has this statement.

    InnoDB: Unable to lock ./ibdata1, error: 35
    InnoDB: Check that you do not already have another mysqld process
    InnoDB: using the same InnoDB data or log files.

    0
  38. 80

    Hello,
    I’ve set up WordPress on MAMP in OS X Lion and everything works and I can log into the WP admin, but when I try to actually go to the site, http://localhost:8888/mysite the browser it redirecting to just http://localhost/mysite and failing to open.
    Does anyone know what might be causing that?
    Thanks.

    0
  39. 81

    Does anyone know how to bring an existing blog to a localhost using MAMP?

    In other words, I have a blog I’d like to make some modifications to, but I would like to test them out first before making any changes to the existing blog. I want the blog on my machine to be an exact duplicate of the blog on the web w/ plugins and all. BTW, I’m using the Thesis Theme by DIYThemes.

    Any help would be greatly appreciated!

    0
  40. 82

    Hello there- just curious as to whether there is a benefit to using Bitnami WordPress stack to develop sites locally on my mac as opposed to MAMP- or are they the same thing?

    0
  41. 83

    Hello,

    I have WAMP set up on my local server with a dnsdns link which works fine.

    But when it comes to WordPress development the wheels fall off!
    Since WP needs the correct URL to access it to run, so when I work on it, it needs localhost URL, but the client will access it eg: xxx.dyndns.com/website

    Is there a way I can redirect the dnydns to local host to bluff my local host its the URL local host accessing it?

    Regards!

    0
  42. 84

    I’m getting stuck on the BASIC CONFIGURATION section. I’ve done everything as outlined, but when I go to the URL http://localhost:8888/wordpress, it comes back as “Not Found”.

    Do you have any idea how I can trouble shoot this? I’ve gone through all previous steps multiple times to see what I might’ve missed, but I can’t find my error.

    0
  43. 85

    Would anybody have a clew as to why I can not select my Dropbox folder from MAMP Pro. It’s just greyed out and I’m unable to select it or select a folder inside of it as a Disc Location.

    It seems that nobody else has any problem selecting their Dropbox folder. Did I miss something? Is it some kind of sharing setting that I missed?

    Please help.

    d.

    0
  44. 86

    I can’t even find the “wp-config-sample.php” in the wordpress directory. Has there been a WordPress update that has removed this file? What file should I be editing now?

    0
  45. 87

    Thank you for such a wonderful post! I wasn’t quite sure if it was okay for me to have my ports set at 8888 for apache and 8889 for MySQL. I also didn’t know if it was okay for me to change the root folder to sites. You answered both my questions beautifully. Thanks!

    0
  46. 88

    Hi,

    I’m trying to move from dev to prod and about everything is working fine except the media uploader in the prod version that says:
    unable to move the file to
    /var/www/vhosts/localhost:8888/httpdocs/wordpress/wp-content/uploads/2013/01

    I tried changing the options in the settings > media options but nothing works…

    Can anyone help?

    0
  47. 89

    My start page looks nothing like yours. I wish I could attach a screenshot. It doesn’t have a single one of those tabs you have. There is nothing that says ‘database” and I don’t see any way to create one. Weird.

    Wait, wait, no, never mind. I had skipped ‘select phpMyAdmin’.

    peace & love, Alice in Blunderland

    0
  48. 90

    When I enter http://localhost:8888/wordpress/ all I get is a blank screen. Been trying various tutorials for hours. Your’s is the only one that’s gotten me this far. Thanks for posting this. I used my user name and a password instead of root in the wp-config.php. Is that what’s wrong? It doesn’t seem to work using root either.

    Please tell me how to get to the WordPress Installation Screen.

    0
  49. 91

    Doing great through your ‘Basic Configuration’ section. But I’m not developing a WordPress site from scratch. I don’t see any mention of how to migrate and existing LIVE WordPress site to my local drive. I want to make significant developments offline using my live site as a starting point. Then, when I’m ready to go live, I can pick at your ‘Going Live’ section.

    0

↑ Back to top