Run Composer versions 1 and 2 simultaneously

Composer 2 is great. But it is not compatible with PHP versions lesser then 7.2. So if you're maintaining legacy projects that require older PHP versions, like PHP 7.1, you run into errors like this:

PHP Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.2.0". You are running 7.1.33.

If you want to be able to run Composer 1 and 2 next to each other, you can install them both.

  1. Install Composer globally, following the instructions from This will install the latest Composer 2 version in /usr/local/bin. (on Mac you can simply run brew install composer)
  2. Move composer to composer2: mv /usr/local/bin/composer /usr/local/bin/composer2
  3. CD to the /usr/local/bin/ folder: /usr/local/bin/
  4. Download the latest V1 version from : wget
  5. Make the downloaded phar file executable: chmod 755 composer.phar
  6. Rename composer to composer1: mv /usr/local/bin/composer.phar /usr/local/bin/composer1
  7. Now create a symlink for the global version you want to use: ln -s /usr/local/bin/composer1 /usr/local/bin/composer. If you are using a local PHP switcher like dnsmasq or valet, make sure to use composer1 as your global Composer version - otherwise you will get Composer errors if you are on PHP < 7.2.0. If you never run PHP < 7.2.0 locally, you should use Composer 2 as your default.
  8. To use global Composer: run composer --version
  9. To use global Composer 1: run composer1 --version
  10. To use global Composer 2: run composer2 --version

That's it. Happy coding!