我尝试在我的 macOS 版本上安装 Composer:
high sierra--> 10.13.4
但是使用命令后:
sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
它创建了一些文件和目录,但没有下载作曲家。 我的终端显示以下错误:
未启用日志处理 - 使用 stderr 日志记录
创建目录:/var/db/net-snmp
创建目录:/var/db/net-snmp/mib_indexes`
如何解决这个问题?
旧答案(Ruby Homebrew 安装程序现已弃用,并已在 猛击。):
首先在您的 MAC 上安装 Brew:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
新答案:
首先在您的 MAC 上安装 Brew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
然后安装PHP:
brew update
brew install php
brew install composer
要测试安装,请运行:
$ 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.