1

After updating my Mac from Yosemite to El Capitan, I am noticing drush does not run properly on any of my sites. Doing a simple:

drush status-report

Command core-requirements needs a higher bootstrap level to run - you[error]
will need to invoke drush from a more functional Drupal environment
to run this command.
The drush command 'status-report' 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.

This is now happening on all my Drupal sites locally, and yes, I am at the root of the Drupal install directory where this command would normally work. I've updated Composer and made sure that stable Drush 7.0.0 is running. Has anyone else come across this behaviour?

Fortunately, I made a full bootable backup of Yosemite so I will 'simply' roll my Mac back to how it was setup prior to the so-called upgrade of El Capitan. Normally I wait at least a month or two before upgrading to Apple's latest release but I got reckless and now this is the price. Sometimes I just want to switch to Ubuntu full time and say goodbye to the Mac OS.

Using:

  • Mac OS 10.11
  • MAMP PRO 3.2.1
  • Little Snitch 3.6 (mentioning this because of this thread)
  • Composer version 1.0-dev
  • Drush 7.0.0

2015-10-17 - Update #################################

First off, thank you for the folks who commented on the original issue. I have decided for better or worse to try again. I updated Yosemite, where Drush, Mamp and everything was working fine, to El Capitan.

I removed drush by editing the .json file for composer by removing the lines for drush and then running composer global update which then finished the job by removing the actual drush files. Composer is up to date, and then drush7 was installed successfully with

composer global require drush/drush:7.0.0

However, once I navigate to a directory with a Drupal install, I am told after running some commands that 'No drupal site was found' and yet, the commands seem to complete regardless. Here are some examples:

drush cron results in the following:

 No Drupal site found, only 'drush' cache was cleared.                       
 'all' cache was cleared.

drush updb results in the following:

 No database updates required     
 No Drupal site found, only 'drush' cache was cleared.                       
 'all' cache was cleared.

drush dl hacked results in the following:

 Project hacked (7.x-2.0-beta5) downloaded to
 /Users/[me]/Sites/[path]/drupal/sites/all/modules/contrib/hacked

Note there was no 'drupal not found' message on the last command. So, my concern is why the 'No Drupal site found' message is showing up. Here is what my .bash_profile looks like:

export PATH="/Applications/MAMP/bin/php/php5.4.42/bin:$HOME/.composer/vendor/bin:$PATH"
export PATH

export DRUSH_PHP='/Applications/MAMP/bin/php/php5.4.42/bin/php'

export PATH=/usr/local/bin:$PATH

None of these settings were changed from how it was in Yosemite. If anyone can shed some light on these issues, I'd really appreciate it. Thanks again.

8
  • How did you install Drush in the first place? Homebrew? Tarball? Do your sites work at all?
    – leymannx
    Oct 5, 2015 at 17:34
  • Drush was installed with Composer. All of my sites worked just fine, and drush worked on every one of them. I have since reverted back to Yosemite and everything is working perfectly but I'm interested to learn if anyone else has encountered this issue. It may have to do with El Capitan's System Integrity Protection
    – PWM
    Oct 5, 2015 at 21:13
  • More likely some system paths got overwritten.
    – leymannx
    Oct 5, 2015 at 22:02
  • Yes, or previously created directories within one or more of the disallowed place, such as /System, /bin, /usr (but not /usr/local), and /sbin no longer have permission to run. I have read that some folks had success with using symlinks. I will stay with Yosemite for a bit longer until I have time to devote to updating both the operating system and the broken applications.
    – PWM
    Oct 6, 2015 at 19:34
  • Yupp, I think I'll wait too. During past OSX upgrades I also did it like you WITHOUT having created a backup before. Then I always ended up completely reinstalling my whole system. Which was a big pain while being in a hurry with running projects. But still, a fresh install maybe was the better choice after all.
    – leymannx
    Oct 6, 2015 at 19:55

5 Answers 5

1

Homebrew

Install Drush by Homebrew:

brew install drush

via Phar binary

sudo wget -O /usr/local/bin/drush http://files.drush.org/drush.phar
sudo chmod +x /usr/local/bin/drush
0

Add this to your .bash_profile file (found here: ~/.bash_profile)

export PATH="/usr/local/lib/drush:$PATH"

If you already have an 'export PATH=", add it like this (colon separated):

export PATH="/other/path:/usr/local/lib/drush:$PATH"
1
  • Thanks Mike. Drush was installed with Composer however, so my PATH is ~/.composer/vendor/drush/drush/drush.
    – PWM
    Oct 9, 2015 at 14:17
0

I think I found the answer! I added /Applications/MAMP/Library/bin: to my PATH, so that it went from this:

    export PATH="/Applications/MAMP/bin/php/php5.4.42/bin:$HOME/.composer/vendor/bin:$PATH"

To this:

    export PATH="/Applications/MAMP/bin/php/php5.4.42/bin:$HOME/.composer/vendor/bin:/Applications/MAMP/Library/bin:$PATH"

And now I am not getting any messages about 'No Drupal site found'. Hope this helps out others.

0

To make it simpler, you may also install drush via:

COMPOSER_BIN_DIR=/usr/local/bin composer global require drush/drush:7

which would automatically install drush binary into /usr/local/bin, so you don't have to add vendor/bin dir into your PATH.

However still you need to add path to your php binary.

If you've installed php via brew, add this line into your ~/.bashrc:

which brew && brew --prefix homebrew/php/php56 > /dev/null && export PATH="$(brew --prefix homebrew/php/php56)/bin:$PATH"

However since you're using MAMP, this can help:

PHP_VER="5.4.42"
export PATH="$PATH:/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php$PHP_VER/bin"

Then make sure you configured your mysql socket correctly by linking into it:

ln -vs /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock

or adding into your php.ini (pdo_mysql.default_socket) or in settings.php (unix_socket).

0

$ brew install homebrew/php/drush

this worked for me, on MacBook Pro - mama - el capitan I installed brew first, then the above command which installed composer as well.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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