To install composer globally, use the following command to download and install Composer as a system-wide command named composer under /usr/local/bin : sudo php composer-setup. php --install-dir=/usr/local/bin --filename=composer.