Reputation: 803
I'm trying to get the Laravel PHP framework installed and for that I need to install Composer. However I'm getting stuck there. I installed it before for Symfony but I couldn't get it to work so I think I deleted it.
When I open the terminal on Mac and enter one of the commands for installing composer like:
curl -sS https://getcomposer.org/installer | php
I get:
-bash: php: command not found
curl: (23) Failed writing body (0 != 1635)
Why is this?
Upvotes: 45
Views: 106900
Reputation: 15887
You can install it via Brew.
First, install Brew;
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Then you can use Brew to install Composer;
brew install composer
That's it, it's now installed. You can verify this by running composer --version
Upvotes: 129
Reputation: 4688
First install brew if not installed in Mac:
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Update brew and install php and composer.
$ brew update
$ brew install php
$ brew install composer
Verify by checking version:
$ composer -V
I hope it helps.
Upvotes: 14
Reputation: 803
I deleted some files that I should not have deleted. Did a repair install of OS X and now it works.
Upvotes: 0
Reputation: 1522
just open your terminal and follow this steps, here odbase is username of my mac.
cd /Users/odbase/Downloads
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
php composer.phar
mv composer.phar /usr/local/bin/composer
(if this produce error please run with prefix sudo. {sudo mv composer.phar /usr/local/bin/composer})
installed for check
cd /usr/local/bin
ls
Upvotes: 2
Reputation: 2211
download file from https://getcomposer.org/installer
execute the file
sudo php installer
mv composer.phar /usr/local/bin/composer
Upvotes: 23
Reputation: 3455
Here it is:
curl -s https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
Upvotes: 16
Reputation: 91
try
~ which php
/usr/bin/php
curl -sS https://getcomposer.org/installer | /usr/bin/php
Upvotes: 2