1.首先安装brew
/usr/bin/ruby -e "$(curl -fsSLhttps://raw.githubusercontent.com/Homebrew/install/master/install)"
2.安装composer
brew install composer
安装的composer可能还不是最新版本的,可以升级一下
composer self-update
可能会报错。代码为:
Error: No available formula with the name "php56-redis" ==> Searching for a previously deleted formula... Error: No previously deleted formula found. ==> Searching for similarly named formulae... Error: No similarly named formulae found. ==> Searching taps... Error: No formulae found in taps.
3.在brew中添加tap
brew tap homebrew/homebrew-php
4.php56-redis 扩展
brew install php56-redis
就能安装成功了,此过程需要一些时间,大概十分钟左右
5.不要忘了重启apache
sudo apachectl restart
6.安装composer
brew install composer
截图:
7.验证composer