Running both Drush 8 (for Drupal 7) and Drush 10 (for Drupal 9) at the same time
Background
These days, my life is all migrations, all the time, which means I often need to run Drupal 7 and Drupal 9 sites side-by-side simultaneously to compare the results.
The problem?
The latest version of Drush, Drush 10, only works on Drupal versions 8.4+. To use Drush on Drupal 7 sites, you need an older version, Drush 8. And both of them use the command drush
. Tricksy...
There are various Drupal-knowledgeable local development environments, such as Acquia Dev Desktop, Lando, DDEV, and Drupal VM that handle this complexity for you, which is super handy. However, the rest of my team uses a "from scratch" local development environment on Mac OS X, so I needed to figure out how to do this by hand.
I made a Twitter inquiry if there was an existing tutorial on how to do this, and since I couldn't find one, here it is. :) Hopefully this helps others, as well! (Thanks to those who responded, pointing me in the right direction!)