125

I ran this command to install globally PHPUnit:

composer global require 'phpunit/phpunit=3.7.*'

Now I want to uninstall globally PHPUnit.

Any ideas?

winkster
  • 1,353
  • 2
  • 8
  • 5

2 Answers2

234

To remove a globally installed package run:

composer global remove phpunit/phpunit

global command lets you to run many commands like install, require or update as if you were running them from the COMPOSER_HOME directory.

Read the related documentation here: http://getcomposer.org/doc/03-cli.md#global

COMPOSER_HOME depends on your system (on Linux it's ~/.composer), see http://getcomposer.org/doc/03-cli.md#composer-home for more details.

Jakub Zalas
  • 35,761
  • 9
  • 93
  • 125
  • Are there any reasons composer global update would not work? I removed a package from my composer.json in .composer and ran the global update but I can still execute the program. – Elijah Lynn Aug 05 '14 at 21:37
  • 3
    A `remove` command has been added to composer. See [this PR](https://github.com/composer/composer/pull/2479) and [this commit](https://github.com/composer/composer/commit/e3f32a79f30e55737c6c75bcf3e688c7c5e1bd9f). – iisisrael Apr 08 '15 at 18:01
  • @iisisrael it doesn't work for packages installed globally and this is what this question is about. Thanks for reference though! – Jakub Zalas Apr 08 '15 at 20:34
  • Composer supports global remove now. Updated the answer. – Jakub Zalas Jul 07 '15 at 13:58
4

Also you can use another way

cd $HOME/.config/composer

And in composer.json file remove some require positions

After all execute composer update This is a long way, but more clear

WiRight
  • 335
  • 6
  • 9