1

Upgraded to MAMP 4 yesterday and cannot get Drush to connect for the life of me. I believe I had a similar problem with MAMP 3, but the following fixed the issue. No luck this time.

sudo mkdir /var/mysql
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock

Any ideas? I have Drush installed globally with Composer. Here's the error:

    Command pm-update needs a higher bootstrap level to run - you will   [error]
need to invoke drush from a more functional Drupal environment to run
this command.
The drush command 'pm-update' could not be executed.                 [error]
Drush was not able to start (bootstrap) the Drupal database.         [error]
Hint: This may occur when Drush is trying to:
 * bootstrap a site that has not been installed or does not have a
configured database. In this case you can select another site with a
working database setup by specifying the URI to use with the --uri
parameter on the command line. See `drush topic docs-aliases` for
details.
 * connect the database through a socket. The socket file may be
wrong or the php-cli may have no access to it in a jailed shell. See
http://drupal.org/node/1428638 for details.

Drush was attempting to connect to:
 Drupal version         :  7.50
 Site URI               :  http://default
 Database driver        :  mysql
 Database hostname      :  localhost
 Database port          :
 Database username      :  root
 Database name          :  ba_dev
 PHP executable         :  /usr/local/bin/php
 PHP configuration      :  /usr/local/etc/php/5.5/php.ini
 PHP OS                 :  Darwin
 Drush script           :  /Users/ja/.composer/vendor/drush/drush
                           /drush.php
 Drush version          :  8.1.3
 Drush temp directory   :  /tmp
 Drush configuration    :
 Drush alias files      :
 Drupal root            :  /Users/ja/Sites/ba/public_html
 Drupal Settings File   :  sites/default/settings.php
 Site path              :  sites/default
4

Figured this out by adding the following to my .bash_profile file and modifying the PHP versions to match what's in MAMP. Working just fine again.

export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php5.4.45/bin:$PATH"
export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php5.5.38/bin:$PATH"
export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php5.6.25/bin:$PATH"
export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php7.0.10/bin:$PATH"

After this run:

source ~/.bash_profile
1

After some hours of search, I finally found the final piece. Hope this help someone :D.

MAMP PRO on Mac enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.