Running a Local Server with MAMP

If you’re a website designer, developer or blogger, the ability to test websites locally can be remarkably useful. It could serve as a testing environment before uploading a new page to your website, or provide a way to work on a website project without an internet connection.

Although OS X comes bundled with a basic web server installed, a more user-friendly solution is available in the form of MAMP. Today we’ll be walking you through the process of setting up a local server with MAMP and outlining the difference between the basic and pro versions.

What is MAMP?

MAMP stands for Mac, Apache, MySQL and PHP. Each of these are the basic elements needed for a functional web server, and MAMP puts them together into an easy-to-use package.

OS X already comes with a basic Apache web server installed, and you’ll be pleased to know that MAMP leaves it completely untouched. No system files are interfered with, and it’s equally easy to uninstall if you find yourself with no use for it.

If you’re planning on creating a site purely with HTML and CSS, there’s no need for a local “web server” as such – just open the file you’ve created in Safari or Firefox. The need for MAMP arises when you need to create a dynamic site with server-side scripting (such as PHP), and a database (in this case, MySQL).

Installation & Setup

After downloading and installing MAMP, you’ll be presented with this simple user interface. Green means that everything is running fine; red means that the server is stopped:

The MAMP Interface

The MAMP Interface

The best starting point after installing MAMP is to click “Open start page”. This will launch your default web browser and take you to the following page:

Welcome Page

Welcome Page

This page confirms that everything is working correctly, and provides the basic settings required for connecting to your local MySQL database. You can view the phpInfo page for details about the version installed and path settings etc, or directly access a database administration tool (which we’ll come to shortly).

MAMP is also a great solution for running web applications locally. I use it for hosting a copy of Fever, a web based RSS reader, resulting in a far more responsive interface than if accessed over the web.

Preferences

MAMP is fairly light on the preferences front but a few exist which are certainly worth mentioning. Firstly, you can select whether opening or quitting MAMP will start/stop the server behind it. Deselecting these two options can be useful if you’d like the server to run in the background with any MAMP user interface.

Start & Stop Settings

Start & Stop Settings

Another setting to be considered is the “Document Root” – where MAMP will look for your website. This can be set to any location on your Mac, and should point to the location of your website files. I have mine set to my “Sites” folder for simplicity, but it can point anywhere.

Alter Document Root

Alter Document Root

Accessing your website is then simply a case of typing “http://localhost:8888/” into a web browser.

Managing a MySQL Database

logo_leftThe inclusion of a MySQL (and SQLite) database is very useful, and saves a great deal of setup and configuration that would otherwise be necessary. Two administration interfaces are available: SQLiteManager and phpMyAdmin. Both are excellent tools for managing the content of your database, tables, and records.

Another option to mention (we are a Mac application blog after all) is to use an app such as Querious or Sequel Pro. Both are perfectly capable of interacting with your local MAMP installation, though you’ll need to use the connection settings displayed on the “Start page” to get everything working correctly.

Should you go Pro?

basicvspro

Two different versions of the servers software are available: MAMP, and MAMP PRO. The professional version has a number of additional features which you may find useful (particularly if testing more than one website):

  • Virtual Hosts – For managing several sites locally, each with their own web address and folder structure
  • Local Mail Server – For sending messages via PHP
  • Dynamic DNS – To allow easy external access to your MAMP installation (outside a local network)
  • Easier configuration of Apache modules

It also has a more full-featured administration interface:

MAMP Pro Interface

MAMP Pro Interface

MAMP PRO costs around $50, but it’s a price worth paying if you feel the additional features may be useful.

Conclusion

If the default Apache installation on OS X isn’t powerful enough for you (and the thought of editing server configuration files makes you shudder), MAMP is a fantastic option. Installation is incredibly simple and you can have a fairly advanced server running in no time at all.

The free release is advanced enough for most casual users, though if you’re looking to test several different domains/websites I would strongly recommend paying $50 for the PRO version.

Do you have any experience with MAMP? I would be interested to know which version you run, and which websites you test locally!


  • Barron

    I’ve been using MAMP for over a year now and love it. I use it to host a local wiki (http://www.mediawiki.org/), WebSVN (http://www.websvn.info/), and a couple of CMake Dashboards (http://cmake.org/) for a small development team. It has been rock solid.

  • Jack Franklin

    I use the free version of Mamp and find it an absolute breeze. Annoying thing is that it asks for my password everytime I load/close it.

    • http://karinnelegault.com Karinne

      I’ve been using it for a while and it never asked me for a password?

    • Daniel Apt

      Have you maybe changed the password for the root user with MySQL?

    • Orca

      I get that too, think its related me setting the ports to default though ! ?

      Very good app indeed, no messing, does what is says on the tin.

    • http://inspiredbywordpress.com Daniel Groves

      I also have to do this, but it does really bother me too much as I don’t have it load on boot, but use the Dashboard widget to fire it up as and when I am designing.

    • http://www.mamp.info MAMP Team

      From the FAQs: “You probably have set the Apache port smaller than 1024. Under a Unix system like Mac OS X you must have “root” (administrative) privileges to start IP-services using ports smaller than 1024.”

      • Aaron

        My ports are 8888 & 8889 and I have to put a password in every time I CLOSE the MAMP app… Is this normal?

  • http://vasili.duove.com/ Vasili

    MAMP is probably in the top 5 most used apps I have. Seeing as how I code more than design, this and Espresso are usually open more than Photoshop. I might upgrade to Pro when I get my MBP, but we’ll see.

    I test, my website, client’s websites, scripts/templates for Themeforest, articles that use PHP, and stuff that I need to do that I can’t do just by viewing a file in the browser.

  • http://diymacserver.com Richard Valk

    You could also build the MAMP stack yourself and control it yourself if you feel geekish or want to know how things really work underneath. You would not need the PRO version to get the same result as all is free! Go to http://diymacserver.com and read all about it.

  • Zac Avery

    I had nothing but trouble with MAMP. Switched to XAMPP (a more up-to-date stack) and it has been a very pleasant experience.

  • http://bitbob.com/ Aaron

    If you’re considering paying $50 for the ability to easily manage virtual hosts, the free version of MAMP and VirtualHostX ($19, http://clickontyler.com/virtualhostx/) might be a better solution. It works with XAMPP and the Apache installation that ships with OS X, so if MAMP updates stop (as they had for a long time), you’re not stuck with a $50 app you have no desire to use.

    The other features of MAMP Pro might make it worth your money though.

  • http://writeforyourlife.net Iain Broome

    I’ve used MAMP several times for messing around with WordPress installations before I make them live. Works perfectly – highly recommeded.

  • Seed

    What do you thing about Zend Server CE? Will there be a review?

  • broshing

    Seems to be a great app ! Someone can confirm that you can use fever with it ? I always wanted to use it but I don’t want to pay for fever AND a web server… So using it with MAM seems to be an excellent way !!

  • broshing

    Seems to be a great app ! Someone can confirm that you can use fever with it ? I always wanted to use it but I don’t want to pay for fever AND a web server… So using it with MAM seems to be an excellent way !!

  • broshing

    OOps, double post :( Would you mine to delete these two message ? Thanks and sorry for the inconveniance.

  • pseudoclass

    Works great for me. It took awhile but I got it working with the dev version of Coldfusion 8 as well.

    Another cool tip is using symlinks for the MAMP sites and database folders so you can keep them synced on two machines via Dropbox (i.e. Workstation and a laptop).

  • dev

    introduction again, it will be good if teach like how to backup before upgrade to new one, how to this and that.

  • Mikkel Hansen

    I love MAMP. I just have this weird problem where I’m being redirected to the live site (on the internet) of a previous site I’ve build, whenever I try to access my localhost!?

    Maybe I’ll have a closer look at XAMPP and see what it can do.

  • http://web2.blogtells.com/ Green Widget

    One user had Kerio running on his server and, to prevent spam by his users, it was limiting the SMTP server to 20 messages per hour… Green Widget

  • Ben Borman

    MAMP Pro is 50% off until September 6 with coupon code mamp-pro !
    I have been using the free version to setup custom WordPress sites, I am now upgrading because $29.50 US is a great value for the extra features!

  • http://www.foxyturkey.com Yigit Ozdamar

    MAMP is really nice app. I’m using it for 1 year with no problem.

  • http://www.tylernichols.com Tyler

    I agree with Zac Avery, MAMP has an outdated stack, also is mostly unsupported by it’s creator (check their forums). I too switched to XAMPP and have been very pleased. XAMPP is also regularly updated.

    • http://www.tylernichols.com Tyler

      I need to make a correction to my comment above. I did not realize that MAMP was very recently updated (after a long lapse from updates). I downloaded the latest revision and it is working great once again.

  • dave

    Horribly insecure & should never be used in production. IMO it’s better to take the 5 minutes it takes to learn how to do the stuff yourself and when something goes wrong you have an understanding of why and you can fix it.

    To many new web developers out there that can’t even add their own sites to a server.

    • http://ketuv.im hayden

      Amen! MAMP is a awesome utility but it’s way too open for production use. I use it on a local machine for development purposes only!

  • Mark Dijkstra

    To bad its for the mac,

    • Mark Dijkstra

      Sorry didn’t see that this is a mac site ;) lol

  • http://pxjunkie.blogspot.com wrerm

    I’ve been using MAMP almost a year now and I love it. Been contemplating going Pro for a while but not sure yet. I may just get an NAS with the features of MAMP Pro. Still weighing the options.

    Great Article though!

  • Jens Ljungblad

    Or you can just install Zend Server (CE) which is a much more powerful solution, actively updated and maintained by Zend, the company behind php. It’s free and works on Mac/Linux/Windows with the added bonus of it being designed to run as a production server.

  • http://greyalley.com desaturated

    been using the free version for some time now.. overall the app is fast and direct. imo a must have for anyone who want to host DB locally ;)

  • Pingback: Ejecutando un servidor local en tu Mac con MAMP, Carrero

  • http://www.mamp.info/en/index.html MAMP Team

    We’ve just released a free bugfix update of MAMP & MAMP PRO: Version 1.8.2 fixes two issues. Download page: http://www.mamp.info/en/downloads/index.html

  • fractalfrog

    I use MAMP since a couple of years, running WordPress locally. Perfect for theme development and easy enough for a stopid designer like me to use.

  • http://designadaptations.com Charity

    Regarding the tip: “MAMP is also a great solution for running web applications locally. I use it for hosting a copy of Fever…”

    I’d be very interested in a follow-up tutorial on how to do that!

  • Pingback: BlogBuzz September 12, 2009

  • http://www.mamp.info MAMP Team

    To make the differences cleaner between MAMP & MAMP PRO we’ve published a feature matrix: http://www.mamp.info/en/mamp-pro/features/matrix.html

    • vanni

      I and others would find it very useful if you developed a little tutorial on how to Set up MAMP Pro to manage multiple Vhosts: Creating the vHosts, Using them, etc.

      For example if one uses the from of http://www.mysite.com:8888/ It does display correctly, but it causes the DNS for your real site to no longer being rendered correctly. Something happens with the DNS…. what in fact happens? Could this not be explained in the docs?

    • Simon

      I agree with vanni. I’ve looked through the manual and there’s nothing regarding configuring MAMP PRO for Virtual Hosts. I’m a bit disappointed because it says on MAMP website that this is what it’s designed for. If that’s the case, why no tutorial on Multiple Virtual Hosting? Hope I haven’t just wasted £39-00!!!

  • Pingback: MAMP سيرفرك الشخصي على جهازك | عالم آبل

  • vanni

    i have been using MAMP for years and it was easy to have multiple sites to test. i simply had sub directories within htdocs… But the draw back was that i was not bale to use real URLS for when i wanted to migrate to my live ISP. So I bought MAMP Pro. I have tried to use multiple Vhosts. Nothing. I can’t get it to work. Shame that the paid version didn’t come with some easy instructions/examples on setting up virtual hosts and then how one gets to view them? Has someone done a good tutorial that they could share?

  • flashmac

    Hi Vanii.. Think I had the same problem. Check this post out.. It helped me.

    I now view all my dev sites just like i would the live sites, so ftping a complete dev site to live doesnt break a thing. All with mamp too.

    http://discuss.joyent.com/viewtopic.php?pid=200786

    Basically (and im using a mac btw):

    Add this to the end of the httpd.conf file (mamp/conf/apache/)

    ServerName yourdevsite.dev
    DocumentRoot “/Users/flashmac/Sites/yourdevsite.dev”

    then edit the host file (/etc/hosts) and add the new site address to the line with 127.0.0.1 like so:
    127.0.0.1 localhost yourdevsite.dev

    then go to http://yourdevsite.dev and hey presto.

  • Sarah

    I just installed MAMP. Can some one write back what is the difference between the path document root being htdocs and users/sarah/site?

    Also, can some one recommend any web development tool in Mac. Can WordPress be used to build websites?

    Thank you,
    Sarah

    • Simon

      BBedit is the best XHTML coding tool for Mac. It’s very easy to understand. It works really well. It save’s the user from doing too much typing: You can drag and drop most of the tags from the toolbar and drop ‘em where you want them in the document – very cool. It’s a lot cheaper than dreamweaver and much faster/stable. The FTP program supplied with it is better than dreamweaver’s.

      CSS edit can be good for css, but overall, BBedit is the best(company’s motto: Software that doesn’t suck)

    • Simon

      The difference between those two paths is this: users/sarah/site is the default location for website testing as per os x installation. htpdocs is a directory/folder that’s created when you installed MAMP.

      WordPress can be used to build websites,but I wouldn’t recommend it initially. This is because to really get WordPress to look and behave as you would like i.e. customizing it, you have to understand php/mysql. Your first priority should be to get a basic grasp of XHTML/css first. This is the markup code that is fed to browsers so you can see a webpage.

      Hope this helps

  • Charles

    I’m having the same problem as Mikkel. When I try to log in to my local installation of WordPress (WordPress + MAMP) I’m redirected to the login page of a live hosted WordPress site I built. I tried clearing browser caches and scowering the local files to see what’s forcing it, but I’ve come up with nothing

  • http://www.bahassi.com Musta

    I have been using the free version of Mamp for a long time. It works quite well and has been helpful enough to save the pain of installing a server through individual modules of php, mysql etc. The only problem I have met is that i could not make the .htaccess files work to enable friendly URLs. Does anyone had this issue? if so please could you tell me how you solved it. thanks a lot

    • http://ketuv.im hayden

      I have and I have also googled many a web sites for answers. I have gotten many answers to how to enable Finder to make hidden files visible but have yet to get it to work. I have resulted to putting my rewrite rules in the virtual host config file instead. I have come to like it so much that I do it in production as well.

  • http://www.bharatbaba.com jay

    Its really good article,
    Thanks.

    +919844542127

  • http://etahamhost.com rajim laymond

    I used Mamp, great app.
    But a problem once set friendly url’s at localhost
    Is there anybody can help out to figure this issue

    thank you in advance

  • http://www.frrtzuVVFRt.com Carri Robberson

    Of course, which a wonderful web page and educative posts, I definitely can bookmark your site. Ideal Regards!

  • http://www.loiiiuud.com Jacquiline Gibeault

    Greetings from Idaho! I’m bored to tears at work so I decided to check out your website on my iphone during lunch break. I really like the information you provide here and can’t wait to take a look when I get home. I’m amazed at how fast your blog loaded on my phone .. I’m not even using WIFI, just 3G .. Anyhow, very good blog!

  • http://www.2jdesign.co.uk Jamie Jackson

    Does anyone know if MAMP can be installed on a Mac Server running Snow Leopard?

  • Mike

    Mamp not starting when i go to open start page

  • http://www.iondigital.co.uk Wayne Austin

    We’re running MAMP pro on our mac server to serve our internal and external content

theatre-aglow
theatre-aglow
theatre-aglow
theatre-aglow