You can do a global installation (archived guide):
Since Composer works with the current working directory it is possible to install it in a system-wide way.
- Change into a directory in your path like
cd /usr/local/bin- Get Composer
curl -sS https://getcomposer.org/installer | php- Make the phar executable
chmod a+x composer.phar- Change into a project directory
cd /path/to/my/project- Use Composer as you normally would
composer.phar install- Optionally you can rename the
composer.phartocomposerto make it easier
Update: Sometimes you can’t or don’t want to download at /usr/local/bin (some have experienced user permissions issues or restricted access), in this case, you can try this
- Open terminal
curl -sS http://getcomposer.org/installer | php -- --filename=composerchmod a+x composersudo mv composer /usr/local/bin/composer
Update 2: For Windows 10 and PHP 7 I recommend this tutorial (archived). Personally, I installed Visual C++ Redistributable for Visual Studio 2017 x64 before PHP 7.3 VC15 x64 Non Thread Safe version (check which versions of both in the PHP for Windows page, side menu). Read carefully and maybe the enable-extensions section could differ (extension=curl instead of extension=php_curl.dll). Works like a charm.