升级osx 10.11后(即osx EI),brew在使用的时候就会直接报错了。因为从10.11开始,对几个重要目录的权限苹果有了新的限制,特别是/usr目录,所以官方有一个解决方法:https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/El_Capitan_and_Homebrew.md
内容很长,如果你是第一次使用brew 就看上面的内容吧,如果你已经使用过了brew(即是从旧机器 升级上来的),你可以来一句简单的办法:
- sudo chown -R $(whoami):admin /usr/local
当然执行完后,你最好还是先用brew doctor检测一下,按照上面的提示一点点的操作,嗯,有些内容你就忽略吧,比如:
- Warning: You are using OS X 10.11.
- We do not provide support for this pre-release version.
- You may encounter build failures or other breakage.
如果你有自己曾经创建的链接扔在/usr/local下面,你就不用理会这一句:
- Warning: You have unlinked kegs in your Cellar
- Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
- those kegs to fail to run properly once built. Run `brew link` on these:
- make
最后还有一个重要的,如果你用的是brew 安装的PHP,你可能还要加上这么一句:
- Warning: Homebrew's sbin was not found in your PATH but you have installed
- formulae that put executables in /usr/local/sbin.
- Consider setting the PATH for example like so
- echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile
因为brew 将PHP的fpm 软链接到了/usr/local/sbin目录下。所以需要将它加到$PATH里面,加完后运行一下source ~/.bash_profile即可
当然,如果这也不行那也不行,别忘了运行一下:xcode-select --install。
Over