Composer Command Not Found Solved

To install composer successfully follow below given steps: these commands 1 by 1.

php -r "copy('', 'composer-setup.php');"

php -r "if (hash_file('sha384', 'composer-setup.php') === 'e5325b19b381bfd88ce90a5ddb7823406b2a38cff6bb704b0acc289a09c8128d4a8ce2bbafcd1fcbdc38666422fe2806') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

php composer-setup.php

Once complete it will download composer.phar in current directory we need to move this file to


so run this command

sudo mv composer.phar /usr/local/bin/composer

If fails then it might give you error no directory exists for "/usr/local/bin/composer".

so we need to create this directory

in terminal run

cd ..

to get out of current directory, run it again and again to reach root directory.

once in root on running


You should get "usr" folder.

if yes then

run this command

sudo mkdir /usr/local/bin

It will create the directory now run this

sudo mv composer.phar /usr/local/bin/composer

it should move "composer.phar" to targeted directory.

Note: you should have composer.phar in current directory to run "sudo mv composer.phar /usr/local/bin/composer" .it you do not have composer.phar then download again using 3 commands given on the top of this guide.