Bake with MAMP on OS X

14 06 2007

The following details are for CakePHP v1.2. They are intended to make baking easier on a Mac. For details on how to use bake I recommend cakebaker’s series on using the bake script.

Baking on Mac with MAMP can be a long winded, typo ridden experience. Check out the full command.

/Applications/MAMP/bin/php5/bin/php ~/eclipse/workspace/cake_1_2/cake/console/cake.php bake

Typing that even for a small site with 3 or 4 models, views and controllers is not fun. Trust me.

First things first – make sure that you have execute permissions on console/cake and console/cake.php. Then add php and the console directory to your shell path variable. Using my path above this would be:

echo 'export PATH=/Applications/MAMP/bin/php5/bin/:/Users/geoff/eclipse/workspace/cake_1_2/console/:$PATH' >> ~/.bash_profile

If you are not using the default bash terminal you will have to change ~/.bash_profile to your shell.

If you have multiple projects it probably best not to put the full console path in but instead use:

echo 'export PATH=/Applications/MAMP/bin/php5/bin/:./cake/console/:$PATH' >> ~/.bash_profile

You will have to change into the projects home directory ( the one that contains app/, cake/, vendors/) and bake from there.

Important : You will need to open a new terminal window after doing this otherwise your new path settings will not be exported.

Also you can add bake as an “External Tool” in Eclipse. Simply Click on Run -> External Tools -> External Tools. Then create a new tool by double clicking on Program. Then add the settings below.

Bake settings in Eclipse

Then to enter bake you can click on the External Tools Icon in the toolbar, click Bake and get baking.

Advertisements

Actions

Information

3 responses

17 03 2008
sooon

hi,

I’ve been trying out your way and still cannot get the path right.

I use your eclipse setting (image above) and it only bake to cake/app/ folder. how can i change to different path like /cake/newapp/ ?? thanks!

2 03 2009
Josh

Very cool. I got this running on my Ubuntu Intrepid VirtualBox and it feels like a super power.

@sooon: If you change the “Working Directory” to read “${folder_prompt}” (without the quotes) it will ask you for the folder to “bake” in, instead of reading it from the workspace information, as shown in this example.

17 04 2009
Neon

Worked great for me!

I did get caught just a bit by my path, as I forgot to route to /cake1.2/cake/console/

Other than that, all is well, finally I can actually start some work!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: