Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't install composer on OS X

I did this on terminal:

$ curl -sS https://getcomposer.org/installer | php

the output was:

All settings correct for using Composer
Downloading...

Composer successfully installed to: /Applications/XAMPP/xamppfiles/htdocs/composer.phar
Use it: php composer.phar

then I entered:

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

No issues with this (it should work because usr/local/bin is in my $PATH). But how do I run it now? When I enter composer or composer.phar on the command line, I get:

-bash: composer: command not found
-bash: composer.phar: command not found
like image 955
jimbo123 Avatar asked Feb 11 '23 06:02

jimbo123


2 Answers

.phar is short for PHP Archive - it's a format that the php executable can read, not an executable on it's own right. To run it you should use:

$ php /usr/local/bin/composer.phar

To make your life a tad easier you could, of course, define an alias:

$ alias composer="php /usr/local/bin/composer.phar"

And then just call composer from your shell.

like image 147
Mureinik Avatar answered Feb 13 '23 20:02

Mureinik


Did u check what do u have now in your path ls -al /usr/local/bin Check the right to execute.

To be sure u can do: sudo chmod a+x /usr/local/bin/composer.phar

First look like should be composer.phar as you did not precise a new name in ur mv command like: sudo mv composer.phar /usr/local/bin/composer

like image 43
Clempat Avatar answered Feb 13 '23 22:02

Clempat