Home  >  Article  >  Development Tools  >  Install composer using brew

Install composer using brew

藏色散人
藏色散人forward
2019-09-30 14:54:034070browse

The following column composer usage tutorial will introduce to you how to use brew to install composer. I hope it will be helpful to friends in need!

Install composer using brew

Check the PHP version in the terminal. Composer requires PHP 5.3.2 version and some PHP configurations

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

Enter

brew install composer

in the terminal and it will appear Problem:

/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!

Solution: Click to view

Method 1:

brew upgrade 然后 brew update

Method 2:

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

After solving the problem, Use brew install homebrew/php/composer to install

After installing composer successfully, I want to install laravel/installer

composer global require "laravel/installer"

After the installation is successful, use the command laravel, but it will display zsh: command not found: laravel

Solution:

//我用的是oh-my-zsh, 在~/.zshrc添加如下
export PATH="/Applications/MAMP/bin/php/php5.5.26/bin:$PATH:$HOME/.composer/vendor/bin/"

The above is the detailed content of Install composer using brew. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete