After much trial and tribulation, I thought I had drush all ready to roar. Much excitement. But then, no joy...

Drush is working. The sites operate fine via MAMP. Regardless, a "drush cc all" command returns:

No Drupal site found, only 'drush' cache was cleared.                                          [warning]
'all' cache was cleared.                                                                       [success]

This question has stumped drupalcon attendees and very experienced developers. Any ideas?

I am on Mac OS 10.9.3 using MAMP (free) Version 3.0.5

Here is my drush status:

 Drupal version         :  7.29-dev                               
 Site URI               :  http://default                         
 Database driver        :  mysql                                  
 Database hostname      :  localhost                              
 Database username      :  db_user                           
 Database name          :  db_name                      
 PHP executable         :  /usr/bin/php                           
 PHP configuration      :                                         
 PHP OS                 :  Darwin                                 
 Drush version          :  7.0-dev                                
 Drush temp directory   :  /tmp                                   
 Drush configuration    :                                         
 Drush alias files      :                                         
 Drupal root            :  /Applications/MAMP/htdocs/mysite.dev 
 Site path              :  sites/default    

Have tried executing drush from /Applications/MAMP/htdocs/mysite.dev; from /Applications/MAMP/htdocs/mysite.dev/sites/default; and using drush cc all --uri=http://localhost/mysite.dev

Tried running drush from sites/default. Same result.

  • is your database connection located in the sites/default folder? If so try just running drush cc from that folder. I dont think --uri is a valid argument for drush cc Commented Jun 19, 2014 at 20:51
  • Tried running drush from sites/default. Same result.
    – jenpasch
    Commented Jun 22, 2014 at 16:28
  • Did you find a resolution for this. I've the same issue and similar setup.
    – Deejay
    Commented Oct 29, 2014 at 13:19
  • I did not. I am still drush-less.
    – jenpasch
    Commented Oct 30, 2014 at 13:38
  • Have you looked at this one? It looks similar off the top: drupal.stackexchange.com/questions/98802/…
    – Laryn
    Commented Nov 3, 2014 at 22:00

6 Answers 6


Please double check that all below points are addressed.

  1. You're running drush in Drupal root folder or folder containing settings.php file.
  2. The mysql command exists (and it's in your PATH).

    Please note that the database command depends on your database driver set in your settings file (e.g. sqlcmd for SQL Server; for details check different classes in Drush's /src/Sql).

    If the command is missing when running in any folder, make sure path to its binary file is added into your PATH system variable.

  3. Your PHP has PDO extension enabled (check by: php -m | grep pdo or drush sqlc).

  4. Your PHP has database extension enabled (e.g. mysqli) (check by: php -m | grep mysql).

To investigate what's exactly wrong, run drush with -v (verbose) and -d (debug) flags, e.g.

drush -vd status
drush -vd ev "echo 123"
drush -vd cc all

and check for any errors.

mysql extension for PHP PDO is not installed. Check your php.ini to see how you can enable it.

Install database extension (e.g. mysqli) (as per above 4th point).

For MAMP, see: Drush does not work on my Mac


Since you're using MAMP, make also sure you running the right version of php binary (check by which php) and it should point to /Applications/MAMP/bin/php/php5.X.X/bin/php. If not, please add the path into your PATH in your rc files (e.g. ~/.bashrc):

# For MAMP (OSX)
PHP_VER="5.6.10" # Or: 5.4.19/5.5.3 (check by: $ ls /Applications/MAMP/bin/php/php*)
export PATH="$PATH:/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php$PHP_VER/bin:/Developer/usr/bin"


For XAMPP for Windows, similar thing, add your C:\xampp\mysql\bin into your environment variable PATH.


If your drush command fails for some reason, here are the suggested steps to debug drush (shell commands).

  1. Install and enable PHP xdebug extension. Verify by php71 -i | grep xdebug.
  2. Verify Drupal root, Settings File and Database are present in drush status.
  3. Generate trace file:

    drush ev "xdebug_start_trace(); drush_drupal_cache_clear_all(); echo xdebug_get_tracefile_name(); xdebug_stop_trace();"


    drush ev "xdebug_start_trace(); print_r(_core_site_status_table()); echo xdebug_get_tracefile_name(); xdebug_stop_trace();"

    If xdebug is enabled for different PHP version, specify with DRUSH_PHP=/path/to/php.

    If successful, trace output file should be printed at the end, so take a note of it.

  4. Now open and check the trace file.

  5. To test or compare drush output with clean Drupal, you can install new Drupal in empty folder by:

    drush -y qd --no-server --core=drupal-8
    cd quick-drupal-*/drupal*
    drush status
  • 2
    +1 really nice answer, going beyond the obvious check settings.php and db. Particularly for me drush sqlc helped me as it showed that the database could not be connected to with the user, which led me to check the user and password and revealed that I had set them up wrong. Thank you! Commented Feb 23, 2017 at 13:18
  • 1
    I had a similar issue to @therobyouknow - I had a ~/.my.cnf file which specified user for mysql connections but not a password. I think this was resulting in drush using the user from that file with the password from the site, which was invalid. Adding a password into my ~/.my.cnf file, or removing that file entirely fixed the problem Commented Mar 26, 2018 at 13:54

Had the same problem with the new Drush 8 on my Mac running MAMP

You need add this to your .bash_profile export PATH=/Applications/MAMP/Library/bin/:$PATH.

once added make sure to open a new terminal window as it won't work on your current window as bash needs to start up again.

  • 1
    This one throwaway line is what fixed it for me. I was pulling my hair out on this one. OPEN A NEW TERMINAL WINDOW WHEN YOU MAKE UPDATES/CHANGES to bash! Otherwise your new settings wont take affect.
    – erier
    Commented Aug 12, 2018 at 19:50

As @kenorb said, use drush -vd cc all, it will give you a good idea about what is happening in detail. In my case, it was due to the error "mysql command not found". I solved it by setting up the path for mysql in my environment variables. I feel you need to check your path as well, for Drush and MySQL both and see if it works.



To clear All Cache using Drush, you have to go the directory of the site on the terminal where your site directory located like in www or htdocs directory and then your project folder after that run the command :

drush cc all

Checkout the Drush package configure.md, it has a bunch of helpful hints for platforms, the MAMP section is thus:

Additional Configurations for Mamp:

Users of MAMP will need to manually specify in their PATH which version of php and MySQL to use in the command line interface. This is independent of the php version selected in the MAMP application settings. Under OS X, edit (or create if it does not already exist) a file called .bash_profile in your home folder.

To use php 5.3.x, add this line to .bash_profile:

export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php5.3/bin:$PATH"

If you want to use php 5.4.x, add this line instead:

export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php5.4/bin:$PATH"

If you use MAMP 3 (php 5.5.14 by default) and want to use php 5.5.x , add this line instead:

export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php5.5.14/bin:$PATH"

If you have MAMP v.1.84 or lower, this configuration will work for both versions of PHP:

export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php5/bin:$PATH"

If you have done this and are still getting a "no such file or directory" error from PDO::__construct, try this:

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

Additionally, you may need to adjust your php.ini settings before you can use drush successfully. See CONFIGURING PHP.INI below for more details on how to proceed.


Running MAMP Pro I got this to work by adding this line into my ~/.bash_profile file:

export PATH=$PATH:/Applications/MAMP/Library/bin

Your Answer

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

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