使用brew安装composer

1166 查看

在终端查看PHP版本Composer要求 PHP 5.3.2+ 版本以及一些PHP的配置

PHP 5.5.26 (cli) (built: Jul  6 2015 14:26:26)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
    with Xdebug v2.2.7, Copyright (c) 2002-2015, by Derick Rethans

在终端输入

brew install composer

出现问题:

/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
[etc..]
Error: update-report should not be called directly!

解决方法:点击查看

方法1:

brew upgrade 然后 brew update

方法2:

cd "$(brew --repository)" && git fetch && git reset --hard origin/master

解决问题后,使用brew install homebrew/php/composer安装

安装composer成功后,我想安装laravel/installer

composer global require "laravel/installer"

安装成功后,使用命令laravel, 但是会显示zsh: command not found: laravel

解决办法:

//我用的是oh-my-zsh, 在~/.zshrc添加如下

export PATH="/Applications/MAMP/bin/php/php5.5.26/bin:$PATH:$HOME/.composer/vendor/bin/"