Mac环境:

Parameter

Value

macOS version:

10.12

Homebrew version:

Homebrew 1.1.0 Homebrew/homebrew-core (git revision 35672; last commit 2017-10-30)

PHP version in use:

php56 & php71

Xcode version:

Version 8.2.1 (8C1002)


完整安装过程信息:

brew search php-version

homebrew/php/php-version

➜  ~ brew install homebrew/php/php-version

==> Tapping homebrew/php

Cloning into '/usr/local/Library/Taps/homebrew/homebrew-php'...

remote: Counting objects: 801, done.

remote: Compressing objects: 100% (618/618), done.

remote: Total 801 (delta 536), reused 240 (delta 175), pack-reused 0

Receiving objects: 100% (801/801), 315.14 KiB | 0 bytes/s, done.

Resolving deltas: 100% (536/536), done.

Error: Invalid formula: /usr/local/Library/Taps/homebrew/homebrew-php/Formula/arcanist.rb

invalid attribute for formula 'homebrew/php/php56': version (nil)

......

。。。。此处省略无数错。。。。

......

invalid attribute for formula 'homebrew/php/php56': version (nil)

Error: Cannot tap homebrew/php: invalid syntax in tap!

➜  ~

其余我又尝试安装php71版本,提示信息各种类库找不到:

apache2 git:(stable) brew install php71

Error: No available formula with the name "php71"

==> Searching for similarly named formulae...

Error: No similarly named formulae found.


查看gcc -v :

➜  apache2 git:(stable) ✗ gcc -v

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1

Apple LLVM version 8.0.0 (clang-800.0.42.1)

Target: x86_64-apple-darwin16.0.0

Thread model: posix

InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin


撸起袖子加油干,折腾了好久,尝试过

尝试一:

➜  log git:(stable) ✗ brew update

Already up-to-date.

提示已经更新。。。没卵用。

尝试二:

查看哪些包是过时的:

brew upgrade 报错error:Error: Cannot tap homebrew/php: invalid syntax in tap!

完蛋了,死路一条。一次性更新不行,尝试更新每个软件包。

brew outdated

这一步倒是出现了几个包,wget cmake ...还有谁记得不得了,只记得brew upgrade cmake更新时依赖

提示dependency of sphinx-doc,也就是cmake依赖sphinx-doc需要先安装更新sphinx-doc,而后折腾了一番.....时间在流逝.... 然并卵。

尝试三:

难道有缓存??那就试试看哪些是旧版本需要移除的。

查看哪些应该清除:

brew cleanup -n

一次性清除所有:

brew cleanup

单独清除单个formula:

brew cleanup

而后再尝试二,.....时间在流逝....然并卵

最后耐心消磨快殆尽,重装所有环境,


答案就在这里:Homebrew终极一战:,homebrew版本有bug版本太旧,需要homebrew 新版本,

先把Homebrew重装:

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



更新之后:

查看brew版本信息,很明显版本升级了:

log git:(stable) ✗ brew -v

Homebrew 1.4.0

Homebrew/homebrew-core (git revision 0e21; last commit 2017-12-13)


安装php72,为了以后做参考我把所有过程拷贝下来,这里有一点要注意安装其他版本的PHP需要将现有的PHP版本解除链接绑定 brew unlink php版本号:

➜  ~ brew unlink php70

➜  ~ brew install homebrew/php/php72


安装详情可参考:brew安装多版本php详情http://www.phpersay.com/index.php?c=index&m=articleDetailInfo&id=109


➜  ~ php -v

PHP 7.2.0 (cli) (built: Dec  3 2017 21:47:51) ( NTS )

Copyright (c) 1997-2017 The PHP Group

Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies

(ps: 完美)

接着安装php-version

可以参考文章:Mac brew install php-version


➜  apache2 git:(stable) ✗ php-version

5.6.25

5.6.30

5.6.32

7.0.10

7.1.12

* 7.2.0

(ps: 完美)

我使用php-version  切换到了php71版本:


查看php -v:

➜  log git:(stable) ✗ php -v

PHP 7.1.12 (cli) (built: Dec  2 2017 12:16:20) ( NTS )

Copyright (c) 1997-2017 The PHP Group

Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies


官网可参考文章:

Homebrew FAQ

brew的各种Formulae包

Github issue:Github issue

本文链接二维码可以保存在本地:保存

| 浏览 (3736) | (0) | (0) | | 2017-12-14 10:25:34 |


相关文章

  1. Mac 终端查看外网IP
  2. 用古诗吵架的小两口
  3. Mac下brew卸载php7重新安装php7
  4. Mac yld: Library not loaded: /usr/local/opt/jpeg/lib/libjpeg.8.dylib
  5. Mac homebrew install php7自定义参数生成libphp7.so
  6. Mac brew安装多个版本PHP