[英]How to install Composer on macOS?
I was trying to install the Composer on my macOS version: high sierra--> 10.13.4
我试图在我的 macOS 版本上安装 Composer: 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未启用日志处理 - 使用 stderr 日志记录
Created directory: /var/db/net-snmp创建目录:/var/db/net-snmp
Created directory: /var/db/net-snmp/mib_indexes`创建的目录:/var/db/net-snmp/mib_indexes`
How can I resolve this problem?我该如何解决这个问题?
Firstly install Brew on your MAC: 首先在你的MAC上安装Brew:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then install PHP: 然后安装PHP:
brew update
brew install php
brew install composer
To test installation, run: 要测试安装,请运行:
$ composer -V
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install composer
composer -v
Install download the composer using the following curl command in the
terminal:
curl -sS https://getcomposer.org/installer | php
After the command, you will have composer.phar file in the current
directory and the composer command is available as:
php composer.phar [composer commnad]
In order to make composer available globally, you have to move the
recently downloaded composer.phar to local user’s bin folder as follow:
go to /usr/local/bin folder . You can click Shift + Command + G to open
the dialog to go to folder.
move the recently downloaded composer.phar in the usr/local/bin folder
create a alias using command alias composer="php
/usr/local/bin/composer.phar"
Now, you can access the composer from the terminal simply using the
composer command. Thats it.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.