I am using CentOS and had same problem.
I changed /usr/local/bin/composer
to /usr/bin/composer
and it worked.
Run below command :
curl -sS https://getcomposer.org/installer | php sudo mv composer.phar /usr/bin/composer
Verify Composer is installed or not
composer --version
This is for mac or ubuntu user, try this on terminal
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer