Drush returns "sh: php: command not found, code: 127"
I just managed to get Drush working finally on my MacBook-Pro (2008). For the longest time Drush would not interact with the Drupal installation. Turns out the reason for this was the fact that Drush expects to use the default MacBook-PHP which is different from the MAMP-Stack-PHP which is what Drupal will be using.
This was sorted out and now appears to mostly work. My environment is MacBook-Pro with Drupal-7.31 and Drush-5.9. I am using the MAMP-PHP-5.5.14.
The conflicting PHP issue was resolved by renaming the MacBook-Default PHP file by adding an extension to its name. Then the .bash_profile file was modified to add a PATH to the MAMP-PHP and an alias was added for file-name of the PHP that Drush usually expects to substitute the newer MAMA-PHP. If you need the details, those are explained in my other recent question: "Drush on Macbook Pro cannot read Drupal Correctly".
Now there is another issue coming up. When I run a "drush upc" or a "drush owiz" command, I get an error: "sh: php: command not found, code: 127". This seems to be telling me that Drush runs an sh-shell command which cannot locate my new MAMP-PHP file.
Any guidelines in fixing this, if this is in fact what this error means?
php -v
from shell from any path, and it returns version you expected, and you'll be OK.