Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Composer on a Mac?

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?

like image 667
Don Kooijman Avatar asked Feb 22 '14 10:02

Don Kooijman


4 Answers

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

like image 198
Mint Avatar answered Nov 05 '22 02:11

Mint


Here it is:

curl -s https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
like image 41
Miroslav Trninic Avatar answered Nov 05 '22 02:11

Miroslav Trninic


  1. download file from https://getcomposer.org/installer

  2. execute the file

sudo php installer
  1. and move the file
mv composer.phar /usr/local/bin/composer
like image 18
luhuiya Avatar answered Nov 05 '22 02:11

luhuiya


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.

like image 9
Siyaram Malav Avatar answered Nov 05 '22 01:11

Siyaram Malav