Home > Development Tools > composer > Install composer using brew

Install composer using brew

藏色散人
Release: 2019-09-30 14:54:25
forward
4107 people have browsed it

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
Copy after login

Enter

brew install composer
Copy after login

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!
Copy after login

Solution: Click to view

Method 1:

brew upgrade 然后 brew update
Copy after login

Method 2:

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

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"
Copy after login

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/"
Copy after login

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

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template