Composer: Command Not Found
Your composer.phar
command lacks the flag for executable, or it is not inside the path.
The first problem can be fixed with chmod +x composer.phar
, the second by calling it as ./composer.phar -v
.
You have to prefix executables that are not in the path with an explicit reference to the current path in Unix, in order to avoid going into a directory that has an executable file with an innocent name that looks like a regular command, but is not. Just think of a cat
in the current directory that does not list files, but deletes them.
The alternative, and better, fix for the second problem would be to put the composer.phar
file into a location that is mentioned in the path
This problem arises when you have composer installed locally. To make it globally executable,run the below command in terminal
sudo mv composer.phar /usr/local/bin/composer
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
or mac brew can try
brew install composer