Update Drush in Acquia Dev Desktop

If you are using Acquia Dev Desktop for spinning up Drupal 8 sites quickly – like I suggested in this article you may run into trouble when trying to use Drush on Drupal version 8.4 and newer.

Update 2018-02-02: You won't need to follow the instructions below to "fix" your Dev Desktop, you simply have to download the latest version of the Acquia Dev Desktop. The "Check for update" function in Acquia Dev Desktop isn't working properly and always tell you that you have the latest version, even when there's a new version available.

If you're using Acquia Dev Desktop with Drupal 8.4 and Drush (which is version 8 in the current version of Acquia Dev Desktop) you'll probably get this error:

PHP Fatal error:  Declaration of Drush\Command
\DrushInputAdapter::hasParameterOption() must be compatible with 
Symfony\Component\Console\Input\InputInterface::hasParameterOption($values, $onlyParams = false) 
in /Applications/DevDesktop/tools/vendor/drush/drush/lib/Drush
/Command/DrushInputAdapter.php on line 27

This is because Symfony in Drupal (8.4.4) has been updated to ~3.2 (it used to be 2.8.x). Long story short: this breaks Drush 8 lesser than 8.1.12 and you'll be needing Drush version 8.1.12 or above to execute Drush commands on your Drupal site.

To patch/upgrade Acquia Dev Desktop you need to update composer.json in the tools folder. To do this on a Mac, which is the OS environment I'm familiar with you open Terminal and go to

cd /Applications/DevDesktop/tools

In this folder you'll find the composer.json file that governs which version of Drush that Acquia Dev Desktop is using. If you wish to, you can inspect this file and change it like so:

nano composer.json
    "require": {
        "drush/drush": "8.1.12"

After this, you can update composer by typing

composer update

And you should be able to use Drush again.

(Drush 9 is compatible with Drupal 7 and Drupal 8.)