Composer 2 Update

New Composer version 2 is out and it is supposed to be way faster then version 1.So tried to update it using

composer global self-update --2

and

composer self-update --2

I however got into this error

Symfony\Component\Console\Exception\RuntimeException]
The "--2" option does not exist.

So did a global update of all packages installed:

composer global update
Changed current directory to /Users/jasper/.composer
Loading composer repositories with package information
Warning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2.0 is now available and you should upgrade. See https://getcomposer.org/2
Updating dependencies (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
Updating laravel/valet (v2.12.0 => v2.13.0): Downloading (100%)
Package deployer/phar-update is abandoned, you should avoid using it. No replacement was suggested.
Writing lock file
Generating autoload files

Then I tried composer self-update --2 again, but did not help and stil had the same error. So did another try using verbose output

composer self-update --2 -vvv
Reading ./composer.json
Loading config file /Users/jasper/.composer/config.json
Loading config file /Users/jasper/.composer/auth.json
Loading config file ./composer.json
Loading config file /Users/jasper/code/smart48.com/valet/auth.json
Reading /Users/jasper/code/smart48.com/valet/auth.json
Checked CA file /usr/local/etc/openssl@1.1/cert.pem: valid
Executing command (/Users/jasper/code/site.com/valet): git branch --no-color --no-abbrev -v
Reading /Users/jasper/.composer/composer.json
Loading config file /Users/jasper/.composer/config.json
Loading config file /Users/jasper/.composer/auth.json
Loading config file /Users/jasper/.composer/composer.json
Loading config file /Users/jasper/.composer/auth.json
Reading /Users/jasper/.composer/auth.json
Reading /Users/jasper/code/smart48.com/valet/vendor/composer/installed.json
Reading /Users/jasper/.composer/vendor/composer/installed.json
Running 1.7.3 (2018-11-01 10:05:06) with PHP 7.4.11 on Darwin / 19.6.0
[Symfony\Component\Console\Exception\RuntimeException]
The "--2" option does not exist.
Exception trace:
() at phar:///usr/local/bin/composer/vendor/symfony/console/Input/ArgvInput.php:217
Symfony\Component\Console\Input\ArgvInput->addLongOption() at phar:///usr/local/bin/composer/vendor/symfony/console/Input/ArgvInput.php:153
Symfony\Component\Console\Input\ArgvInput->parseLongOption() at phar:///usr/local/bin/composer/vendor/symfony/console/Input/ArgvInput.php:82
Symfony\Component\Console\Input\ArgvInput->parse() at phar:///usr/local/bin/composer/vendor/symfony/console/Input/Input.php:54
Symfony\Component\Console\Input\Input->bind() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:200
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:843
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:193
Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:254
Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:117
Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:103
Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:56
require() at /usr/local/bin/composer:24
self-update [-r|--rollback] [--clean-backups] [--no-progress] [--update-keys] [--stable] [--preview] [--snapshot] [--set-channel-only] [--] []

Then I decided to do a general update of version 1 first

composer self-update -vvv
Reading ./composer.json
Loading config file /Users/jasper/.composer/config.json
Loading config file /Users/jasper/.composer/auth.json
Loading config file ./composer.json
Loading config file /Users/jasper/code/site.com/valet/auth.json
Reading /Users/jasper/code/site.com/valet/auth.json
Checked CA file /usr/local/etc/openssl@1.1/cert.pem: valid
Executing command (/Users/jasper/code/site.com/valet): git branch --no-color --no-abbrev -v
Reading /Users/jasper/.composer/composer.json
Loading config file /Users/jasper/.composer/config.json
Loading config file /Users/jasper/.composer/auth.json
Loading config file /Users/jasper/.composer/composer.json
Loading config file /Users/jasper/.composer/auth.json
Reading /Users/jasper/.composer/auth.json
Reading /Users/jasper/code/smart48.com/valet/vendor/composer/installed.json
Reading /Users/jasper/.composer/vendor/composer/installed.json
Running 1.7.3 (2018-11-01 10:05:06) with PHP 7.4.11 on Darwin / 19.6.0
Downloading https://getcomposer.org/versions
Updating to version 2.0.5 (stable channel).
Downloading https://getcomposer.org/download/2.0.5/composer.phar.sig
Downloading https://getcomposer.org/download/2.0.5/composer.phar
Downloading (100%)
Use composer self-update --rollback to return to version 1.7.3

And then I got to version 2.0.5 funnily enough:

composer -V
Composer version 2.0.5 2020-11-06 20:57:15

So there was no need for the --2 after all. Perhaps cause version 2.x is stable now. Now let’s hope my Laravel installs play nice with Composer version 2 as I was told it would and be way faster!

Jasper Frumau

Jasper has been working with web frameworks and applications such as Laravel, Magento and his favorite CMS WordPress including Roots Trellis and Sage for more than a decade. He helps customers with web design and online marketing. Services provided are web design, ecommerce, SEO, content marketing. When Jasper is not coding, marketing a website, reading about the web or dreaming the internet of things he plays with his son, travels or run a few blocks.