Over the weekend, I updated my MAMP PRO installation to 2.1.0. After doing so, I needed to reinstall PHPUnit via Pear but I hit a snag: I kept receive the “pear command not found” console message.

Pear Command Not Found

Luckily, it’s a relatively easy fix but it does come with a caveat:

Assuming you’re running MAMP, you can resolve the “pear command not found” message by doing the following:

  • Locate your PHP installation. If you’re using MAMP, there are likely several version of PHP all of which are located in /Applications/MAMP/bin/php.
  • Navigate PHP5.3.13. I tend to use the most recent PHP version so my directory of choice is php5.4.3. Unfortunately, I was never able to get this version working so I’ve relegated to using PHP5.3.13 for time being. In the mean time, I’m tracking an issue with the MAMP developers.
  • Update File Permissions. From the root level of your PHP installation directory, execute the following command: `chmod +x bin/*.` This will make all files in the bin directory executable.

If successful, no message should be returned and you should be back at the command prompt

At this point, you can follow my PHPUnit, WordPress, and MAMP guide for installing PHPUnit and resolving any conflicts that you may experience.

I’ll also do a follow up post once the ticket is resolved with the MAMP developers, but if you happen to resolve the issue please place it in the comments.

Update July 11, 2012: According to the MAMP bug base, this error has been resolved. I assume it will be available in the next release. I’ll follow-up once the next version of MAMP has been released.