3

I am developing on Mac OSX 10.10. I am not using MAMP, Aquia Desktop or anything like that. Instead, I am using the built in PHP/MySql in Mac (set up using this tutorial).

When I run Drush, I get this error:

Command pm-enable 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 'en views' could not be executed. 

(No other text is displayed).

If I do Drush status, I get the following:

 Drupal version         :  7.37                                                 
 Site URI               :  http://mysite.local                               
 Database driver        :  mysql                                                
 Database hostname      :  127.0.0.1                                            
 Database username      :  dbuser                                      
 Database name          :  dbname                                     
 PHP executable         :  /usr/local/bin/php                                   
 PHP configuration      :  /usr/local/etc/php/7.0/php.ini                       
 PHP OS                 :  Darwin                                               
 Drush script           :  /Users/myname/.composer/vendor/drush/drush/drus 
                           h.php                                                
 Drush version          :  8.0-dev                                              
 Drush temp directory   :  /tmp                                                 
 Drush configuration    :                                                       
 Drush alias files      :                                                       
 Drupal root            :  /Users/myname/Sites/mysite                 
 Site path              :  sites/site1                                

Steps I have tried

1. Re-installing Drush via this tutorial

The tutorial says to install Drush via Composer. The install works, but when I re-run Drush, I get the same error.

2. Install Drush via this tutorial

This tutorial recommends to install it via Homebrew. When I do this, I get this error:

  Problem 1
    - Installation request for d11wtq/boris v1.0.10 -> satisfiable by d11wtq/boris[v1.0.10].
    - d11wtq/boris v1.0.10 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system.

I've looked extensively on the Internet for how to fix this, but I just find sites saying I need to compile from source. They provide no steps on how to to do this, and I don't know what it means.

3. Using the 127.0.0.1 trick

(Changing host to 127.0.0.1 in settings.php).

Thanks for any help

2

A "possible" reason might be because Drush commands must be issued from the appropriate subdirectory of your website (change to the directory where your Drupal site is installed and try again).

So try navigating to the sites/default folder (assuming this is NOT a multi-site), and then retry your Drush comand.

If that doesn't help, it could well be an issue with the version of Drush that you are using. Would it be an option to downgrade to a lower version of Drush? FYI: Drush 6.x does support D7 also ...

| improve this answer | |
  • Yes, I am doing it from the site folder that contains settings.php. I also have the same problem if I run it on a non-multisite. – big_smile Jul 14 '15 at 9:36
  • How do I downgrade to Drush 7 on Mac. I've looked around, but there are no tutorials. – big_smile Jul 15 '15 at 10:20
  • 1
    How about "uninstall" of the current version, and then "instal" of Drush 7? That's what I would try to do (though I've never done that). – Pierre.Vriens Jul 15 '15 at 10:32
1

Pierre.Vrines answer is correct, Drush needs to be at version 7.0 when using a multisite that has a shared database (in my case shared user tables).

There aren't many good tutorials on rolling back, so here is how I did it as it might help someone:

1. Remove the symbolic link to Drush.

Because I had followed both the Drupal.org tutorial and the composer installation tutorial, I had Drush 8 installed in my Mac home directory. To remove it, I simply did this in the terminal:

unlink /Users/madhusharma/drush/drush

then

 nano ~/.bash_profile

Once bash_profile is open, delete the Drush reference and save.

Next restart the server.

 sudo apachectl restart

Finally, move the Drush folder out of the home directory.

2. Downgrade via composer

Just one line in the terminal, taken from here:

composer global require drush/drush:7.*

Restart again:

 sudo apachectl restart

Optional: Uninstall Via composer

Before doing step 2, it might be an idea to uninstall Drush 8 via composer. There's a Stack exchange thread that explains how here. Basically:

  1. Edit your composer.json file, e.g. (in terminal)

    nano ~/.composer/composer.json

and remove line containing drush. Save the file.

Update Composer PHP packages by:

composer global update

It will remove the globally installed drush.


Install Drush properly in the future

The reason I got into this mess was because there are so many conflicting Drush installation tutorials for Mac. The best way of doing it is by using the following in the terminal:

sudo mkdir /usr/local

sudo mkdir /user/local/bin

sudo curl -sS https://getcomposer.org/installer| php

sudo mv composer.phar /usr/local/bin/composer

~/

nano ~/.bash_profile

This will open nano, so enter export PATH="$HOME/.composer/vendor/bin:$PATH" Then press Ctrl+X and Save

source ~/.bash_profile
| improve this answer | |

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.