Drupal - Updating Drush with Composer

If you want to update your global installations of any package under composer, you can just do this:

composer global update

You don't need to navigate to .composer/vendor/drush/drush

However: There are a couple of things:

1) Your global composer.json file might have a version constraint.

Check out drush's packagist page: https://packagist.org/packages/drush/drush

That will show you the available release versions of drush.

Edit ~/.composer/composer.json so that the version constraint for drush/drush is higher than the one you have. Probably something like "~8".

Do composer global update.

2) It's best practice to install drush per project.

The reasons why are a little complex and might not answer the question here, so I'll just link to an article: https://pantheon.io/blog/composer-vs-drush-make-which-should-you-use


I would add that, depending upon your needs, composer global update may not bring you up to the version you need. I had run it, and was only getting to version 8.1.8.

For my needs, I needed 8.1.14, at minimum. Since the latest stable version was 8.1.15 as of now, I simply ran this: composer require drush/drush:8.1.15. This ran fine, and then checking by drush --version, which registered the proper version then.

Tags:

Drush

Composer