0

I know that Drush is a huge time saver so I'm trying to get familiar with it but I keep getting

command not found

error after installation. I've required and removed Drush a couple of times just to make sure I'm doing this correctly.

Here's what I did:

$ cd mydrupal
$ composer require drush/drush

After I run the above command many things install:

Using version ^9.3 for drush/drush

./composer.json has been updated

Loading composer repositories with package information

Updating dependencies (including require-dev)

Package operations: 57 installs, 0 updates, 0 removals

  • Installing... (many things download and install (100%))

And I end up with this:

Writing lock file

Generating autoload files

Drupal\Core\Composer\Composer::preAutoloadDump Drupal\Core\Composer\Composer::ensureHtaccess

Then I get my command line prompt and I run

$ drush status

and I get this:

-bash: drush: command not found

Any ideas?

2 Answers 2

1

You are calling a global command. Which is not installed or symlinked into one of your Mac's autoloaded bin directories (or is not added to your global $PATH).

Simplest option you have now is to use the local command:

$ cd mydrupal
$ vendor/drush/drush/drush status

Alternatively you may want to install Drush Launcher on your Mac (to be used together with the Composer template for Drupal projects). Which when you are inside a project that has a local Drush installed automatically associates the global drush command to the project's local Drush.

0

I had this issue and it was due to config_sync_directory not being defined in settings.php. Example...

  $settings['config_sync_directory'] = 'sites/default/files';

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.