How to Install Composer 1 and Composer 2 Side by Side on macOS
Máximo Martinez Soria
Tooling
While most projects will likely use Composer 2, there are times when you need Composer 1 to make changes to an older project that was originally built using Composer 1.
The most common way to handle this is by switching versions using an update. To switch to Composer 1: composer self-update --1.
To switch to Composer 2: composer self-update --2.
However, this is not very practical. If you need to run these commands several times a day, it quickly becomes a waste of time.
A much better alternative is to install both versions and use different commands for each one. In my case, I like to use composer for Composer 2 and composer1 for Composer 1.
This way, I never need to downgrade.
Setting this up is quite simple. Let’s see how to do it…
-
Install Composer using Homebrew. This will install version 2.
brew install composer -
Rename the
composerbinary tocomposer2so the versions can be distinguished.mv /usr/local/bin/composer /usr/local/bin/composer2 -
Move into the installation directory.
cd /usr/local/bin/ -
Download Composer 1.
wget https://getcomposer.org/download/1.10.17/composer.phar -
Change permissions so the file can be executed.
chmod 755 composer.phar -
Rename the binary to
composer1.mv /usr/local/bin/composer.phar /usr/local/bin/composer1 -
Create a symlink to define which command points to each version. Important: run only one of the following commands. The “default” version is the one executed with the
composercommand. The other version will be executed usingcomposerX, where X is the version number.# Composer 2 as default # Commands: composer (Composer 2) and composer1 ln -s /usr/local/bin/composer2 # Composer 1 as default # Commands: composer (Composer 1) and composer2 ln -s /usr/local/bin/composer1
Done! It’s that simple to have both versions of Composer installed and use one or the other whenever needed.
Feb 9, 2026
WordPress
Enterprise Web Governance: Ensuring Speed and Compliance
Feb 2, 2026
WordPress
Role of Security in Website Development: Impact on Enterprise WordPress Platforms
Feb 19, 2026
WordPress