Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Composer on macOS?

I was trying to install the Composer on my macOS version: high sierra--> 10.13.4

but after using the command:

sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" 

It created some files and directory but it didn't download the composer. My terminal displayed following error:

No log handling enabled - using stderr logging

Created directory: /var/db/net-snmp

Created directory: /var/db/net-snmp/mib_indexes`

How can I resolve this problem?

like image 389
Giuseppe Iaria Avatar asked Aug 02 '18 15:08

Giuseppe Iaria


People also ask

How install composer install?

Step 1: Navigate to the official composer website. Step 2: Then click on the Download button. Step 3: Then click on the Composer-Setup.exe & download the file. Step 4: Then click on “Install for all users”.

How do I update the composer in Mac terminal?

Using the Installer# This is the easiest way to get Composer set up on your machine. Download and run Composer-Setup.exe. It will install the latest Composer version and set up your PATH so that you can call composer from any directory in your command line. Note: Close your current terminal.


1 Answers

OLD Answer (The Ruby Homebrew installer is now deprecated and has been rewritten in Bash.):

First install Brew on your MAC:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

NEW Answer:

First install Brew on your MAC:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Then install PHP:

brew update
brew install php
brew install composer

To test installation, run:

 $ composer -V
like image 191
Lukas Avatar answered Sep 28 '22 09:09

Lukas