Categories
Apple CakePHP Development

macOS + MAMP + CakePHP (bake)

Are you using macOS, MAMP, and trying to bake some CakePHP code? Are you having trouble because you get an error in Terminal such as this:

Fatal error: You must enable the intl extension to use CakePHP.

And I bet all you did was browse to your CakePHP site and tried to run this:

bin/cake bake

Well, you could install intl via Homebrew or one of the half-dozen other solutions I found, or you could simply do the following:

  1. Install/upgrade to MAMP 4.x
  2. On the left, select Languages > PHP
  3. Select the checkbox labeled: Make this version available on the command line.
  4. Click Save

Once you’ve done, open up Terminal again (if it’s already open, type exit and Quit Terminal first before trying this again) and browse to your CakePHP site. This time, instead of what you typed above, simply type the following command:

php bin/cake.php bake

This should work just fine, as php is now aliased to the MAMP PHP version (step 3 above), which has intl install, and you’re specifying the PHP script directly, bin/cake.php, and together you’ll be able to bake all the CakePHP code you need.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.