16

There is a method of installing Drush via Composer.

composer global require drush/drush:dev-master

How do I uninstall it using Composer?

2
  • 3
    Not really Drupal-related as such but stackoverflow.com/questions/19217477/…
    – Clive
    Nov 1, 2014 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, 2014 at 23:22

2 Answers 2

28

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?.

5
  • 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. Jun 22, 2016 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, 2016 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! Jun 22, 2016 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, 2016 at 14:11
  • I have followed your instructions, now my composer.json only contains {}. composer does not want to remove drush nor does it want to reinstall it or install a different version. Stupid me hasn't made a backup of the file :( Would love to hear how to get out of this mess...
    – Jakke
    Jan 19 at 6:49
15

You can use composer global remove drush/drush to uninstall a global Drush.

Or use composer remove drush/drush to uninstall a project-local Drush.

0

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.