Magento on the Mac
13 Jul 2009, by Denis Margetic
7 Comments · Posted in Magento

Magento is a web-based application, and therefore Magento development is thankfully not limited to any particular platform or operating system. As a Mac user I prefer to do my Magento development on my Mac. In setting up my development environment, I discovered that there are very few useful resources out there for other developers looking to do the same. So hopefully this post will serve as a start for others looking to do the same.

Even though OS X comes with Apache and PHP, both of those tend to be a little out of date and it is generally easier to just install a MAMP (http://en.wikipedia.org/wiki/MAMP) rather than individually setting up PHP and MySQL. The MAMP package that I have been using can be found here: http://www.mamp.info (download link).

I found the following benefits in using this particular MAMP package:

  • easy to install and set up
  • no system files are changed
  • easy to delete since everything is in one directory
  • easy to start/stop the Apache and MySQL servers
  • meets all Magento pre-requisites
  • comes with a couple of PHP caching extensions pre-installed
  • phpmyadmin is pre-installed

To install, you should simply extract the zip file into the Applications directory. Please note that in order for this MAMP stack to work, it must be located in the Application directory. Once installed, opening the file called 'MAMP' in the MAMP directory will bring up a Preferences Panel.

There you can change the preferences associated with the running of the MAMP package. It also comes with a widget, which allows for quick starting and stopping of Apache and MySQL. By default, Apache runs on port 8888 and MySQL on port 8889. You can change the ports at any time under Preferences > Ports.

Before you can install a local copy of Magento, you will need to setup a database. Fortunately, this MAMP package comes with phpmyadmin pre-installed, which makes that task very simple. To get to phpmyadmin, click 'Open start page' either on the widget or in the Preferences Panel. That will take you to this page:

which you can also reach by entering the following url: http://localhost:8888/MAMP/. However, the apache server must be running in order to do this, so make sure you click 'Start servers' first.

To create a database for Magento follow these steps:

On the phpmyadmin start page click 'Privileges'.
Click 'Add a new User'
Fill in the following:
User name:'Use text field:' magento
Host:     'Local'           localhost
Password: 'Use text field:' -enter your password-
Re-type:	  	    -enter your password-
Under 'Database for user' 
select 'Generate database with same name and grant all privileges'
Click 'Go'

Once you have created a database, you need to download Magento. Extract the Magento zip file into the following directory:

/Applications/MAMP/htdocs/

If you want to use another directory you can set a different 'Document Root' in the Preferences Panel. To install Magento open http://localhost:8888/magento, provided that you are still using the default '8888' port. Just follow the instructions provided by the installation script to complete the installation. When you are entering the database information make sure that you change 'localhost' to 'localhost:8888' or whatever port number you are using. Also enter the database name, mysql user and the mysql user password, all of which you would have created in the phpmyadmin steps above.

Once the installation is completed you will be able to load your local copy of Magento with the following url: http://127.0.0.1:8888/magento. Note that when it comes to Magento it is important to use '127.0.0.1' instead of 'localhost' when accessing via a browser, since otherwise the Magento admin panel may not load.

You should now be all set to start developing for Magento on your Mac.

Comments

Very helpful, thanks for putting this up.
Comment by bruiser - 20 Jul 2009 3:38:28 AM
I'd advise instead of using 127.0.0.1 you use your actual IP addres, this means you can do IE testing via vmware/parallels without needing to change the address in the backend.
Comment by orta - 4 Aug 2009 11:46:03 PM
Great stuff, going to try this tonite.
Comment by Thank You - 10 Sep 2009 12:02:11 PM
Do you use an IDE for development?

I've been using Aptana with the PHP plugin for some time now on Mac, but I've never been able to get it properly configured for remote debugging of Zend/Magento.

I saw in another post Peter's using vim and Xdebug with a local vim session on a linux image - I'd love to hear how else people set up their systems.

Comment by Ben - 10 Sep 2009 4:33:18 PM
I've got the same question as Ben - what is the "proper" way to setup an IDE to work with Magento?

Currently I'm using Coda on the Mac, but it seems a bit clunky with Magento's folder structure. I'd much rather switch over to something like Netbeans, Aptana, or Eclipse if I can get it setup properly.
Comment by Brady - 10 Feb 2010 11:04:06 AM
I am still searching for the best IDE for Magento myself. I like Netbeans, though like Eclipse, it can be quite a strain on RAM. My attempts to get Aptana going where unsuccessful, though this was a while back and things may have improved now. Currently I use Coda, though I wish it had some more features that come with Netbeans. I will report back if I find a good IDE solution for Magento development.
Comment by Denis Margetic - 10 Feb 2010 12:16:00 PM
i am using zend studio on my mac and zand server ce on ubuntu box, everything including debugging works like a charm
Comment by Anonymous - 24 Mar 2010 8:01:30 AM
Comments are closed for this post