Posted on

Command line Magento 1.5 install on MAMP

In my last big post on Magento deployment there were a number of simple little tidbits that on their own may be useful to people who might not be ready to jump headlong into the sort of project structure I described.

So with that in mind I thought I’d pull out the first of the useful tips, this time installing Magento 1.5 on MAMP (OSX) all via the command-line, it saves time and is nicely repeatable for scripting. Plus OSX is a unix system, why not make use of it!

In this little guide we’ll be installing Magento into your webserver’s document root. If that doesn’t mean anything to you, it may be worth checking out a couple of my earlier MAMP guides.

I wrote two related guides a while back that you may also find useful, for setting up MAMP based Magento development environments. Firstly a guide to installing MAMP on a Mac and secondly a way to set up virtual hosts on MAMP.

Update: Before we go any further, I included steps for downloading that use wget, which as Talesh quite rightly noted is not included with Mac OSX by default. I suggest you get wget on Mac OSX using Homebrew but there are other ways too.

Alternatively you can use curl to grab the file like this:

curl > magento-

Ok, so we’re ready to begin. These commands should be copy-pastable, if anything goes wrong let me know.

cd ~/Downloads
# If you do not have wget installed (see above) you can use curl.
tar xzf magento-
#This assumes your document root is ~/Documents/web
mv magento ~/Documents/web/magento/

Now we create the database, again we can do this on the commandline, to save time fluffing around with phpMyadmin.

# Your password is probably still 'root', unless you changed it.
/Applications/MAMP/Library/bin/mysql -uroot -p -e "create database magento1501"
# Put your own ulta secure password in place of 'password' below
/Applications/MAMP/Library/bin/mysql -uroot -p -e "grant all on magento1501.* to magento1501@'localhost' identified by 'password'"

Now we run the actual Magento install on the commandline. It pays to set the permissions before installing.

cd ~/Documents/web/magento/
chmod -R o+w media var
chmod o+w app/etc

This next command runs the actual install. There are several things you need to change to match. others are optional, for example timezone, currency and locale can all be changed later in the admin, but for a local development environment the defaults are probably fine. The admin email/username/password, database details and base url are all important. Screwing these up will render the install broken – happily it won’t take you long to re-run the above commands and start over if that happens, right?

/Applications/MAMP/bin/php5/bin/php -f install.php -- --license_agreement_accepted "yes" --locale "en_US" --timezone "America/Los_Angeles" --default_currency "USD" --db_host "localhost" --db_name "magento1501" --db_user "magento1501" --db_pass "password" --url "" --use_rewrites "yes" --use_secure "no" --secure_base_url "" --use_secure_admin "no" --admin_firstname "max" --admin_lastname "power" --admin_email "" --admin_username "admin" --admin_password "password"

Update: Thanks to Nathan for pointing out that the latest version of MAMP has a two versions of PHP in it. You’ll need to run:/Applications/MAMP/bin/php5.3/bin/php in the above command.

If it worked you’ll see something like SUCCESS: 183748... with a big long hash code. Now you should be able to see the default Magento start page here: and log in to the admin panel at /admin.

Let me know if you have any troubles with getting these commands to work. I ran through them myself doing an install and everything was just fine, but if your environment is set up differently there could be some subtle issues.

8 thoughts on “Command line Magento 1.5 install on MAMP

  1. How would you go about installing extensions…

    Normally I would use “./pear install etc/etc”

    But where is pear as of Mage 1.5???

  2. Alan Storm was twittering about that stuff today. I haven’t checked but maybe ./mage ?

  3. I’m running MAMP 1.8.4 on OS X 10.6.7. I ran into a problem using as my base URL.

    I got a SUCCESS message after running the last command and loaded successfully. However, clicking on any home page link and loading /admin were both unsuccessful.

    Following the exact same steps again, I replaced “” with “localhost” in the final command and everything works properly.

  4. The final command needs revised for MAMP 1.9.5 which has two versions of PHP: 5.2.17 and 5.3.5(default). Adjusting the final command to “/Applications/MAMP/bin/php5.3/bin/php” would logically work, but the command hangs for me. Anyone else experience this or know a workaround?

    Thanks, Ashley, for providing these instructions.

  5. Thanks Nathan, I have updated the article with your tip.

    Also, the behavior you described where the home page loads but none of the links or the /admin loads is consistent with mod rewrite not working properly. For example does /index.php/admin work? or any other similarly altered URL’s?

    I can’t think why the hostname would affect the mod_rewrite though, unless the localhost host had different Apache config to the 127... one.

  6. I was still having problems with the final command at the time of my last comment. Changing MAMP’s PHP version from 5.3.5 to 5.2.17 and updating the command accordingly fixed the problem for me.

  7. @Nathan Roberts Yes there seems to be a problem running CE1.5.0.1 on PHP 5.3.5 using MAMP – both command line and browser installation. Using PHP 5.2.17 works fine though.

  8. Someone asked above, but just thought I’d ask again if anyone new how to run ./mage terminal commands on MAMP?

Comments are closed.