There is method of installing drush via composer:

composer global require drush/drush:dev-master

But how to uninstall it using composer?

  • 3
    Not really Drupal-related as such but stackoverflow.com/questions/19217477/… – Clive Nov 1 '14 at 23:16
  • 4
    Thanks, I didn't see that. Drush has the documentation how to install it, therefore I think there should be drush related information how to uninstall it. – kenorb Nov 1 '14 at 23:22

It seems there is no single remove command, so you need to:

  1. Edit your composer.json file, e.g.

    vim ~/.composer/composer.json

    and remove line containing drush. Save the file.

  2. Update Composer PHP packages by:

    composer global update

    It will remove a globally installed drush.

If you don't have composer command in your PATH, try php composer.phar instead.

See: How to remove a package from composer?.

| improve this answer | |
  • There is no mention of drush in my ~/.composer/composer.json. Even I run composer global update it is not removing. I can still see it using drush version command. Why is so? I have PHP 5.3.29 on Ubuntu 14.04. Please advise. – Niladri Sarkar Jun 22 '16 at 10:47
  • @NiladriSarkar Maybe drush has been installed by the different method. Check which drush or check to which package this file belong, etc. – kenorb Jun 22 '16 at 12:43
  • which drush shows /usr/local/bin/drush. And I installed drush using composer. Reference: docs.drush.org/en/master/install and docs.drush.org/en/master/install-alternative. How can I resolve it now please help! – Niladri Sarkar Jun 22 '16 at 12:59
  • @NiladriSarkar It may be just a symlink, so check where it points to, or just remove the symlink. It's best if you ask another question saying your drush is not in composer.json and it's still there, but it's rather question at superuser. Since it won't be a quick one. Or you may add bounty to this one clarifying how this doesn't solve the problem for you. Normally it should be removed by composer global update if global composer.js doesn't have it. – kenorb Jun 22 '16 at 14:11

You are now able to run composer [global] remove drush/drush to uninstall it.

| improve this answer | |
  • I had to use composer global remove drush/drush. No [ ] – Chris Jun 30 '19 at 20:53
  • 1
    @chris When people give example commands, they often put optional arguments in [brackets]. So that means either composer remove drush/drush or composer global remove drush/drush. – Ken Williams Oct 2 '19 at 3:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.