Set Up a Mac Server with MAMP

For those of you who have dabbled with website design and development, you may be interested to know that OS X is bundled by default with the Apache web server. This allows you to easily develop websites on your own computer without the need to invest in a domain name or hosting package. However, the standard Apache system in Leopard is fairly limiting for those wanting to delve deeper into web based development languages such as PHP and database technology.

Fortunately, there is a remarkably simple way to set up a fully featured server on your Mac: MAMP. We previously mentioned MAMP when it was conceived way back in 2005, but this post will explain in a little more detail exactly how simple it is to install, configure and start using your MAMP installation.

The abbreviation MAMP stands for: Macintosh, Apache, MySQL and PHP. These are the four main constituents you need to design and develop a full featured website or application on your Mac.

Downloading MAMP

There are two versions of the server available to download, both of which come bundled in the same 130MB package. MAMP Pro is a configurational program for MAMP, allowing you to set up any number of servers to carry out tests without danger for your live system. It’s aimed primarily at those running a production server on their OS X machine, and at the outset you’ll likely be fine with the free version.

Once installed, it creates a ‘MAMP’ folder in your Applications directory. This contains the entire server along with the directory in which to place your website files (‘htdocs’).

Configuring and Using MAMP

There are three main components installed with MAMP.

  • Apache: This is the basic web server, and makes the display of HTML pages possible. You can view your local Apache web pages through the URL http://localhost:8888/.
  • MySQL: This is the database server, and comes bundled with a utility for easily adding, editing and removing database tables and records — phpMyAdmin. This is the easiest starting point for getting to grips with MySQL. The default username and password for the database install are both ‘root’.
  • PHP: Where HTML is great for displaying content, PHP allows you to process information and connect to the MySQL database to store and retrieve information. MAMP allows you to choose between using PHP4 or PHP5, and the configuration options for both can be found in /Applications/MAMP/conf/.

Starting and stopping all these services can be done through the MAMP application itself, or through the bundled Dashboard widget.

The full list of services bundled with MAMP consists of:

  • Apache 2.0.59
  • MySQL 5.0.41
  • PHP 4.4.8 & 5.2.6
  • APC 3.0.14
  • eAccelerator
  • XCache 1.2.0
  • phpMyAdmin
  • Zend Optimizer 3.3.3
  • SQLiteManager 1.2.0
  • Freetype 2.3.4
  • t1lib 5.1.1
  • curl 7.18.2
  • jpeg 6b
  • libpng-1.2.18
  • gd 2.0.34
  • libxml 2.6.32
  • libxslt 1.1.24
  • gettext 0.17
  • libidn 0.6.14
  • iconv 1.11
  • mcrypt 2.5.8
  • YAZ 3.0.6 & PHP/YAZ 1.0.12

Uninstalling MAMP

If you choose to remove MAMP at any time, uninstallation is as simple as dragging the folder from your Applications folder to the Trash. This makes a huge change from a standard server installation which would historically include a series of complicated uninstall steps. If you are interested in the app on a superficial level it is easy to install it, play around, and remove it with no long-lasting effects on your system.

Going Live

Once you’ve created a world-changing web application on your local machine, you’ll need to search for somewhere to host the site permanently. Unfortunately, even if your ISP offers a fixed IP address, hosting your website ‘at home’ is unadvisable. It’s likely to be considerably slower than a server hosted in a professional data center and can cause some tension between you and your ISP. There are literally thousands of hosting companies offering a professional service, with the one I would recommend personally being Media Temple.

Do you have any experience using MAMP, or are you employing a different tactic to locally test and design websites?