OS X: How to Install Symfony into MAMP

   Posted May 21, 2008 by David Kirk in Apple Mac

Installing the open source php framework Symfony into an OS X box can be a challenge. By using MAMP and these directions, you will be up and running in no time.


MightyQ is becoming a jedi Symfony master. Just as I was getting skilled in plain ole php, he is now dragging me (correctly) into the world of Symfony. Here are the steps I used to get Symfony up and running in MAMP.

Now, I already had MAMP installed from my previous project of installing wp using MAMP in OS X.

If you do not have it, go ahead and download MAMP. Mount the MAMP dmg and drag the folder directly into your applications directory. Do not use a subdirectory.

Open the php.ini text file in a text editor. It should live here:

/Applications/MAMP/conf/php5/php.ini

Change the memory limit to 32M by editing the memory_limit part of the file to the following:

memory_limit = 32M ;

Save the file and close your text editor. Now fire up your terminal…

Now we are going to move leopard’s php to a safe place…

sudo mv /usr/bin/php /usr/bin/php-old

Link the MAMP php into where leopard’s php used to be…

sudo ln -s /Applications/MAMP/bin/php5/bin/php /usr/bin/php

If you have PEAR already installed, we are going to move it as well. If you don’t have PEAR, this will obviously error out which you can ignore.

sudo mv /usr/bin/pear /usr/bin/pear-old

Link MAMP’s PEAR into bin…

sudo ln -s /Applications/MAMP/bin/php5/bin/pear /usr/bin/pear

The following two commands will use PEAR to download and install symfony.

pear channel-discover pear.symfony-project.com
pear install symfony/symfony

Now place link symfony into bin…

sudo ln -s /Applications/MAMP/bin/php5/bin/symfony /usr/bin/symfony

If everything has worked correctly, you should now be able to fire up symfony from the command line.

I originally got the majority of these directions from the following thread.

 

About David Kirk

David Kirk is one of the original founders of tech-recipes and is currently serving as editor-in-chief. Not only has he been crafting tutorials for over ten years, but in his other life he also enjoys taking care of critically ill patients as an ICU physician.
View more articles by David Kirk

The Conversation

Follow the reactions below and share your own thoughts.

  • Cindy

    AWESOME!!! Thanks for the info! Saved me hours!

    • No problem! Welcome to the world of symfony! It’s an amazing framework!

  • Felix

    Somehow it doesnt work, even though i followed everything and did not get any errors it always gives me “command not found” when i try to use any symfony commands like
    symfony propel-build-all-load

    • dave

      symfony propel-build-all

      • dave

        or
        symfony propel-build-model
        symfony propel-build-sql
        symfony propel-insert-sql

  • nice one! Thanks

  • dave

    Thanks a lot …. works great for me

  • Something you may want to add is a link to mysqladmin so that you can quickly setup databases from the command line as well.

    sudo ln -s /Applications/MAMP/library/bin/mysqladmin /usr/bin/mysqladmin

    is the line you’d do to do it.

    Thanks for the help by the way, I was having issues getting symfony installed through pear.

    • hi there

      very good tutorial! thanks a lot, saved me couple of hours/days

      I was wondering what these command lines do:
      sudo ln -s /Applications/MAMP/library/bin/mysqladmin /usr/bin/mysqladmin

      thanks!
      Pieter

  • Raúl

    better with “sudo …”

  • Chuck

    Thanks. That was very very helpful

  • Anonymous

    I get a command not found on any symfony command I try. Any ideas?

  • Flurdulis

    I am getting permission denied when I try to run PEAR that is a symbolic link to a MAMP php5.3/bin/pear. Any solutions?

    • LeadingLight

      The executable bit is probably not set on the php and pear binary. Use these comands

      cd /Applications/MAMP/bin/php5.3/bin and use
      chmod +x php
      chmod +x pear

  • wrightgd

    I got everything installed correctly, but now I’m having a problem generating apps. I can’t help but thinking this might be somehow related to how the install locations/etc are different since I’m on a mac. Basically, when I run php symfony generate:app frontend in terminal, I receive no errors, but the directory structure the getting started tutorial describes is not created in the apps folder as it should be. Any ideas as to what might be causing this?

  • Jad

    Hi,
    does the same apply to Mavericks?