0

I'm having some questions about installing the latest drush, and the more I search, the more conflicting advice am I getting. I need both drush 8 and 10, since I am testing both Drupal 7 and 9. I had installed drush 8 a while back as a standalone in /usr/local/bin/drush8. But I can't figure out how to create a similar standalone version of 10 (one that would be moved to /usr/local/bin/drush10). I'm using MACOS 12.3, symfony 4.4.35, PHP 7.4.12, drupal 9.3.9

From Google, answers seem to say to just got to the Drupal 9 installation root and use composer require drush/drush, while drupalize.me says to install it as a dev dependency with composer require --dev drush/drush (is using a dev a good idea?). When I try doing this, it is trying to install drush 11. Should I be using 11 instead of 10? I tried using composer require "drush/drush: ^10.6.2" and got a bunch of errors, so using 11 sounds good to me.

https://webchick.net/drush-and-drush has instructions, but I can't get it to work; for one thing, she says to download the release 8.4.1's drush.phar file, with isn't in the repo.

Anyway, I do have 8 working ok, and now would like to be able to use 11 (or 10) for Drupal 9 testing. Can it be installed in a global location like /usr/local/bin, or is tied to each Drupal installation?

1
  • Drupalize.me is wrong. This should be fixed.
    – leymannx
    Mar 30, 2022 at 5:44

1 Answer 1

2

Drush for Drupal 9 no longer supports global installation, so you need to install it as a dependency on each Drupal 9 site you want to use it with.

You mentioned being confused by several sites, but the Drush docs are quite clear:

Drush only supports one install method. It requires that your Drupal site be built with Composer and Drush be listed as a dependency.

So... install drush 11 as a dependency.

Install it as a regular dependency, not a dev dependency because drush should be available in production, and it is a best practice not to install/deploy dev dependencies to production.

You should be using Drush 11 not Drush 10 because, as the documentation linked above states, Drush 10 went end of life in January 2022.

It's good to Google for tutorials, but always check the official documentation first.

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.