I’m writing a full series on setting up your Mac for Magnto ecommerce development, I should probably start with the first step – installing MAMP on a Leopard Mac, even if it’s a quite basic and hopefully self evident.
Maybe one of the less obvious things is that you do not need MAMP pro to get virtual hosting set up in Apache on a Mac, but it will require you to work with Apache config files as described in my post on setting up virtual hosts in apache on MAMP.
Step 1: Download MAMP
Is this a redundant step? I hope so anyway, go download MAMP you want the non-pro version as shown below.
Step 2: Install MAMP
Double click the downloaded zip file to extract the disk image (.dmg file). Then double click the .dmg disk image to mount it.This will pop up the following dialog.
It feels kind of moronic even writing this, but incase there are people out there who need to know, you literally just drag the MAMP folder and drop it on the Applications folder in this dialog.
Step 3: Configure MAMP
After installing you can run MAMP any number of ways, you could navigate to the APplications folder in Finder and double click it, or just open spotlight (ctrl + space bar) and start typing ‘MAMP’ then just push enter when it find it, as a top hit. When it starts you’ll be presented with a dialog like this:
Go to preferences, I’ll just show you how I configure it quickly, you obviously don’t have to configure it this way, but I think it helps later when setting up your development environment. My configuration will mean you need root access (well, you’ll need sudo access – same diff) on your macbook. If you are installing MAMP on a macbook, you probably have this already.
You’ll want application default ports, rather then the MAMP defaults, this will mean your MAMP needs to run on protected ports, and thus you’ll need elevated priveleges to run it. It will mean your URL’s all look normal and your mysql setup in applications like Magento or Drupal will be more standard though.
Also configuring a more personal document root for Apache is nice too. I always lik to have one in my home directory, but you can put it whereever you like. here is the setup I use:
After doing the config changes you’ll need to stop and start the servers to have the new changes take effect. On starting them again you’ll be prompted for your password so that MAMP can open port 80 for Apache. This is normal, and although a slight inconvienence, it’ll mean your web URL’s can be www.example.com
when you set up virtual hosting instead of being www.example.com:8888
.
So that should have given you a MAMP setup on your macbook. Now you can follow my tutorial for setting up virtual hosting with Apache. Also shortly I’ll put up a full Magento install tutorial for MAMP with virtual hosting, to tie these two tutorials together. So stay tuned.
Speaking for myself, as a Mac newbie, I really appreciate you describing the installation process in detail. It was not (but is now) obvious that I had to drag the dmg to the application – now that I have done so for this and other installations, it seems so elegant 🙂
Thanks for a great post.
Thanks for the feedback, I appreciate it. If there are any topics you’d like me to write about, let me know.
Thanks Ashley for this. VERY helpful. I am going to setup a Magento Test Environment. On to you next post —> http://www.aschroder.com/2009/02/how-to-set-up-apache-virtual-hosting-on-mamp-for-magento/
This worked!
I had changed to the default apache port but didn’t change the mysql port and was wondering why i couldn’t connect to mysql using the host name (example.com) i configured in my hosts file to point to localhost.
I wanted to make it so that my local code is exactly the same as my remote code. so i put example.com in my hosts file to point to localhost. then, to see the remote version, i would just comment that line out.
now, i realize it’s probably just better to have slightly different code on my local machine, and just configure cyberduck to ignore on sync the two config files i have that store database connection info. i use cyberduck and not git cause i’m on a godaddy economy plan… really want to use git though. i might switch to dreamhost for that. but godaddy is cheaper. what do you think?
Hi Ashley
When I switch to the default port settings MAMP can’t seem to start Apache up again. Mysql starts up again fine. I had been messing around trying to get a MySQL& PHP (entropy pkg) environment going through terminal and kept running into problems on this new leopard machine I’ve purchased, so I am wondering if there’s anything I need to change back in the conf or ini file or anything, from my earlier attempts pre-MAMP?
Hi, Sam
Thanks for commenting. When you change your ports to the application defaults, MAMP requires administrator access to run. This is because port 80 that Apache runs on is protected by the operating system (it’s a UNIX thing).
It sounds like your MAC OSX is not prompting you for a password when an application requests those privileges. What happens on my system is Mysql starts fine then Apache goes to start and a popup dialog appears asking me for my username and password (or an admin if I’m not one) after entering them, Apache starts. Perhaps there is an OSX config that controls whether the OS tries to present the popup, or just denies access?
I do not think you need to worry about the ini or conf files as MAMP uses it’s own PHP binary (and config).
Cheers,
Ashley
Hi,
I followed these steps, and encounter a problem. When I change the ports to the standard ports and then stop and start the servers everything seems to be fine. I’m not prompted for the admin password, but both servers start back up, and the settings remain in the preferences panel. However, going to localhost/MAMP/ doesn’t do anything. Going to localhost:8888/MAMP/ does get to the right place. When I restard MAMP and go to preferences, they have returned to the MAMP defaults.
Any ideas?
Thanks.
My guess would be permissions, but to be honest I really do not know. Are you running MAMP as the same user who installed it? Do you have another Apache installed that might already be listening on port 80?
Actually, now port 80 works fine, but the mysql port goes back to the standard setting. Still, the doc root setting is blank every time I reopen MAMP…. I don’t think there’s anything else installed other than the stuff that comes with the computer. But web sharing is off in preferences….
The sharing stuff will probably only affect the firewall rules, hard to know why your MAMP keeps forgetting it’s settings. You could try to re-install it, perhaps something is wrong with the install?
If any newbie out there decides do try this tutorial, beware that it may mess up your mamp installation. It did mine.
I don’t know about these tutorials. First, in one post the author announces mamp and magento installation, then, it’s all about MAMP. Some people should keep to their programming… and give up teaching….
I’m sorry my tutorial wasn’t helpful, you’ll notice I’m always more than willing to help people out, you could try describing what is wrong, maybe the problem can be solved, and the solution can help others?
I have just downloaded IMAMP 1.7.2, but i still confused to install on my leopard 10.5.6. I did not find any IMAMP application to install. I have unzipped the file, and there would be a folde MAMP_1.7.2_src, and subfolde MAMP. i expanded the folders, no application found. only zip, tar or plain text files.
The MAMP application (co click) as u said, no icon/file in there.
Thank you for your help and my thanks in advance.
Regards,
arief
Hi, Did you download the source code bundle by mistake? The _src in that filename makes me think you did. Anyway try to download the binary version for mac and let me know.
Hi Ashley, great post, great website!
I think I know how to solve the problem with port 80.
I had the same issue, so I opened my System Preferences, then selected Sharing and unchecked “Web Sharing”. Voilá, Apache starts!!!
HTH,
Rafael Vogel
Hi,
I found this tutorial to set up MAMP after trying all kinds of ways to set up mySQL, PHP and phpMyAdmin the hard way.(The installations worked but I couldn’t’ get them to communicate). Anyway, when I set the default Apache and MySQL ports, I too was unable to restart the servers.
a) to get Apache restarted —> same as what Rafael said — go to System Preferences and uncheck Web Sharing
b) To get MySQL server restarted —> go to OS Preference pane, choose MySQL preferences and turn off the MySQL server; also uncheck the automatic startup (these came from when I set up MySQL from the separate MySQL installation)
Thanks for the tutorial!
Hey, Great post! I followed your instructions but now Apache isn’t working.
Do you mean the Apache that is part of MAMP? Or one that you have installed outside of MAMP? If you have MAMP running, you won’t need any other Apache running and should be able to stop and start using the MAMP graphical interface.
Hi Ashley,
Thats a pretty decent Mamp set up guide, I used this a while ago and it was damn helpful. Recently I changed the way I use mamp so that I could have my dev sites exactly the same as my live sites, like this:
http://www.mysite.dev
http://www.mysite.com
Here is my guide if it helps any one:
http://www.dangermoose.co.uk/set-up-your-mamp-like-a-dev-king/
Hi Ashley, I installed the MAMP and the red light next to the SQL doesn’t turn green it stays red but the one next to apache is green what could be the problem and how do I slove it?
Ashley,
I found your blog after having installed MAMP to run MySQL through the Netbeans IDE on my MacBook Pro. I ran into a problem for which I haven’t yet had any response from the MySQL, MAMP, & Netbeans forums. I’m posting here in case you might have a solution.
————————————
Problem: When trying to run PHP pages from a Netbeans project, I get following output
H​​​
5.5.9​​​​​:*_$3re(​ÿ÷​​​​€​​​​​​​​​​​1^hou{-jQ5T’m​ysql_native_password!​​​ÿ„​#08S01Got packets out of order
* ‘garbage’ characters (e.g., “$3re(​ÿ÷​​​​€​​​​​​​​​​​1^”) vary
* “H”, “5.5.9”, “mysql_native_password!”, “Got packets out of order”, & the error code remain same
* PHP pages DO display properly when I switch to Apache (but my DB is in MySQL)
***********************
MacBook Pro OS X 10.6.7
Netbeans 7.0
Java 1.6.0_24
MAMP 1.9.6
PHP 5.3.5
Running MySQL Server in MAMP at port 3306
In the Netbeans Services window, I’m able to register MySQL Server as localhost:3306 [root] with the following properties:
Host Name: localhost
Port No.: 3306
User Name: root
P/word: root
Admin Property paths…
Admin Tool:/Applications/MAMP/MAMP.app
Start Cmd: /Applications/MAMP/bin/startMysql.sh
Stop Cmd: /Applications/MAMP/bin/stopMysql.sh
* In the Services window, able to create DBs, tables, & execute SQL commands.
* But when I try to use MySQL Server from a NB PHP project (e.g., NB tutorial //netbeans.org/kb/docs/php/wish-list-lesson2.html), I only get the output noted above
* I uninstalled, and then re-installed, both NB 7.0 and MAMP, but with the same problem
Thanks for any assistance.
Sorry Nick that’s a new one to me. Are you sure you have given Netbeans the right port etc? Looks like junk data being sent or something?
Thanks for the reply, Ashley. I followed the tutorials for MAMP, XAMMP, WorkBench twice each. But no worries: I just wanted to try PHP, but I’ve got an NB RCP app cooking and jsp/GlassFish for now.
I am having the same issue as Nick. MySQL server will not connect and stays red. Is there a certain way I should have the WordPress files set up or maybe the Document Root? Or does that matter? I am also bot able to open the start page. What’s weird is it all worked initially…and then I tried to organize the files and notta. Any thoughts?
Whoops…meant the same issue as Tsepo.
This post is pretty old but I stumbled upon it when I was searching for an answer to the same problem as nick.
I got the same error:
“5.5.25�O���]j!^8<bZ�ÿ÷�€����������~,]q@,XY6?yd�mysql_native_password�!��ÿ„#08S01Got packets out of order" but mine had slightly different variables.
My solution was to open the preferences box of MAMP and select the "Ports" tab, there I assigned the right ports:
Apache Port 8888
MySQL Port 8889
After this step you can acces the page by: http://127.0.0.1:8889/wordpress/