繁体   English   中英

"如何在 macOS 上安装 Composer?"

[英]How to install Composer on macOS?

我试图在我的 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`

我该如何解决这个问题?

首先在你的MAC上安装Brew:

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

然后安装PHP:

brew update
brew install php
brew install composer

要测试安装,请运行:

 $ composer -V
  1. 在 Mac 终端中安装 Brew

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

  1. 安装作曲家

brew install composer

  1. 检查作曲家

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM