Overview
Composer is an application-level package manager for the PHP programming language that provides a standard format for managing dependencies of PHP software and required libraries.
Installation
Download the latest composer.phar file from the download page (scroll to the bottom). Check where the file downloaded to (most likely the downloads folder) and then move to user/local/bin
sudo mv composer.phar /usr/local/bin/composer
If you still have problems, such as "No file or directory", then create the bin directory if it doesn't exist and try again.
mkdir -p /usr/local/bin
If composer still can't be installed, then open the bin folder manually with
open /usr/local/bin
and drag composer.phar in there, and remove the .phar extension.
Once it's installed, run composer in the terminal, and you should receive the composer screen. In case of an error, make sure you follow the steps correctly with admin privileges (e.g. using sudo on a Unix machine).
Important composer commands
composer require package/library
composer install
composer update
composer dump-autoload -o