Thursday, March 11, 2010

Another command line fix for y’all

CakePHP’s bake script can be very useful to generate a data access model with CRUD operations almost instantaneously. However, depending on your install, it may not work properly. When I first tried it, I got the following error in Terminal:

-bash: cake: command not found

The fix for this is very simple, but took me hours to find the first time. Totally worth it because I’ve saved many more hours in development time by using it.

  1. cd to the root of the cakephp install (should be called cake_1.x.x or similar)
  2. type the following command:  ./cake/console/cake bake

And voila! The script should start its magic immediately.