You are viewing an old revision of this post, from December 8, 2015 @ 22:31:17. See below for differences between this version and the current revision.

Get WP CLI to use MAMP’s version of PHP

I just set up WP CLI and it wasn't working because I had MAMP installed. This advice fixed the issue at hand: [http://stackoverflow.com/questions/4145667/how-to-override-the-path-of-php-to-use-the-mamp-path/10653443#10653443] In your home folder /Users/David for exmaple, you can create a .bash_profile. In here you can export variables and then add them to your path. Open up the file to edit it in your favourite editor, I use vim. Then you can add in your path [js]export MAMP_PHP=/Applications/MAMP/bin/php/php5.3.6/bin export PATH="$MAMP_PHP:$PATH"[/js] You want your bit ahead of the $PATH as that already includes /usr/bin which is where the system PHP lives. So the system will always find your MAMP version first. Save this file and then reboot your Terminal and you'll see that you should get your MAMP version. To test I use php -v as OSX Lion uses 5.3.10 and my MAMP is using 5.3.6 You can also test using which php which will output the path to your current php executable.

Revisions

  • December 8, 2015 @ 22:31:17 [Current Revision] by PeterLugg
  • December 8, 2015 @ 22:31:17 by PeterLugg
  • December 8, 2015 @ 22:30:35 by PeterLugg

Revision Differences

There are no differences between the December 8, 2015 @ 22:31:17 revision and the current revision. (Maybe only post meta information was changed.)

Tags: , ,

No comments yet.

Leave a Reply