Installing CakePHP with MAMP

5 comments

Posted on 29th April 2009 by Krow in Tips & Tricks

, ,

At work we have a few developers that use Mac’s. I have come to like them much more then I used to. So much I bought one for my wife. Still not for me cause I can buy a PC for much cheaper and have grown very happy with Ubuntu.

Any way to the topic at hand I found that helping set up CakePHP on a Mac with MAMP was a bit different and thought I would post here for others to use and for myself to reference if I need to do it again.

These steps are based on the environment we work on and are in some cases preferences too. You can choose to do the steps differently to your setup but for my purposes this has worked great.

  1. Download the latest version of CakePHP (http://www.cakephp.org)
    At the time of this writing the current version of CakePHP is 1.2.2.8120
  2. Unzip and rename the folder to cake
  3. Go to the “Sites” directory and drop the new cake directory there
  4. Find the path for the CakePHP console (i.e. /Users/username/Sites/cake/cake/console )
  5. Find the path for the php directory (i.e. /Applications/MAMP/bin/php5/bin )
  6. Launch a terminal window
    • Type nano .profile
      • Some alias I prefer to have:
        • alias www=”cd /Users/username/Sites/public_html”
        • alias mysql=”cd /Applications/MAMP/Library/bin/mysql -uroot -p”
      • Enter the following:
        • export PATH=”/Applications/MAMP/bin/php5/bin:/Users/username/Sites/cake/cake/console:$PATH”
        • CTRL X
        • Save
    • Restart your profile
      • . .profile
  7. In your terminal you can now bake
    • Type www
    • This will take you to your web directory
    • Type cake bake project name…

That is it. As I mentioned this post is mostly for a refrence for myself but I hope that it can be a help to others as well. But I would be interested to hear what others have to say and prefer.

5 Comments
  1. benjam says:

    What I did on my WAMP box, in addition to putting the ./cake dir in my PATH, was set up a symlink (yes, you can create symlinks (junction points) in Windows on NTFS), from ./cake to the latest version (./cake_1.2.2.8120), which makes updating cake a cinch, just unzip the latest version, and move the symlink.

    Then I got into my php.ini file and set up the include_path directive to include the ./cake directory:
    include_path = “.;c:\php\includes;C:\Development\cake”
    (note, it is a Windows box, so yours may look different)
    Now, when I’m working on work projects on my local box, I don’t need to worry about setting the CAKE_CORE_INCLUDE_PATH for all of them (which are baked on a *nix box), and everything just works, which is how it should be.

    29th April 2009 at 9:44 am

  2. 13 excellent CakePHP tutorials | blogfreakz.com says:

    [...] Installing CakePHP with MAMP [...]

    29th April 2009 at 2:44 pm

  3. 10 Must Read CakePHP Tutorials | Cookie Labs says:

    [...] Installing CakePHP on MAMP [...]

    29th April 2009 at 9:33 am

  4. Adam says:

    I am new to Terminal and working from the command line and was wondering if you could help me out a little. After hitting CTRL X and choosing Y to save, what do I select on the menu that follows?

    29th April 2009 at 1:31 am

  5. Onlyice says:

    Thanks man…. work perfectly but only in 1.2.7, there is an error on 1.3 stable…. but is in the cake not in your configs… thanks… keep walking!

    29th April 2009 at 8:05 am

Leave a comment

You must be logged in to post a comment.