How to install Composer on macOS?

2019-06-27 17:17发布

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?

1条回答
beautiful°
2楼-- · 2019-06-27 17:44

Firstly install Brew on your MAC:

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

Then install PHP:

brew update
brew install php
brew install composer

To test installation, run:

 $ composer -V
查看更多
登录 后发表回答