A guide to Globally Installing Drush 8 for Drupal 7 on Mac with MAMP, that actually works.

This deals with Globally installing drush on a MAMP development environment on macOS, running a version of MAMP with PHP5.6.
Prerequisites: Homebrew and Wget

Get drush

cd ~/ 
# Download latest stable release using the code below or browse to github.com/drush-ops/drush/releases. 
wget https://github.com/drush-ops/drush/releases/download/8.4.10/drush.phar 
# Or use our upcoming release: wget http://files.drush.org/drush-unstable.phar

test and rename it

php drush.phar core-status 
chmod +x drush.phar 
sudo mv drush.phar /usr/local/bin/drush 
drush init

edit bash profile

pico ~/.bash_profile

inside bash profile add:

# Use MAMP version of PHP
PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`
export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH

# Export MAMP MySQL executables as functions
# Makes them usable from within shell scripts (unlike an alias)
mysql() {
    /Applications/MAMP/Library/bin/mysql "$@"
}
mysqladmin() {
    /Applications/MAMP/Library/bin/mysqladmin "$@"
}
export -f mysql
export -f mysqladmin

then run

source ~/.bash_profile

Confirm with status

$ drush status

Result should look like..

Drupal version                  :  7.54                                               

Site URI                        :  http://default                                     

Database driver                 :  mysql                                              

Database hostname               :  localhost                                          

Database port                   :                                                     

Database username               :  root                                               

Database name                   :  coolsite_local_dev_database                                          

Database                        :  Connected                                          

Drupal bootstrap                :  Successful                                         

Drupal user                     :                                                     

Default theme                   :  cooltheme                                       

Administration theme            :  seven                                              

PHP configuration               :  /Applications/MAMP/bin/php/php5.6.2/conf/php.ini   

PHP OS                          :  Darwin                                             

Drush script                    :  /usr/local/bin/drush                               

Drush version                   :  8.1.13                                             

Drush temp directory            :  /tmp                                               

Drush configuration             :                                                     

Drush alias files               :                                                     

Install profile                 :  standard                                           

Drupal root                     :  /Users/X/Mamp/2016/website/httpdocs

Drupal Settings File            :  sites/default/settings.php                         

Site path                       :  sites/default                                      

File directory path             :  sites/default/files                                

Temporary file directory path   :  /Applications/MAMP/tmp/php

ERRORS ERRORS ERRORS

drush cannot download updates PHP5.6

simplexml_load_file(): I/O warning : failed to load external entity "" Project.php:74 [warning]
Failed to get available update data from https://updates.drupal.org/release-history/drush/7.x [error]
Could not download requested project(s).
$ drush pm-update drupal
Update information last refreshed: Never
 Name    Installed Version  Proposed version  Message                     
 drupal  Unknown            Unknown           Specified project not found 

No code updates available.                                                                        [ok]

What didnt work

enabling

;extension=php_openssl.dll

in php.ini by removing the ; this is mentioned in a few blogs and StackOverflow posts as a solution.

What did work

Upgrade mamp to get php7.1

Don’t forget to make sure the configs are copied out to a safe place before updating.
Copy your apache Vhost conf settings from the backed up version of MAMP, allow inclusion of /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf in your
/Applications/MAMP/conf/apache/httpd.conf

Was this article helpful?
YesNo