Score:0

how to install drush 10 concurrently with 8?

in flag

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?

leymannx avatar
ne flag
Drupalize.me is wrong. This should be fixed.
Score:2
cn flag

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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.