Blog

Blog

PHODAL

Homebrew 修复大作战

在升级git成2.9的时候,终于遇到了之前升级时Homebrew的坑,于是只好一个个来修复。

执行:

brew doctor

返回了一系列很长的日志,于是便保存了日志,然后一个个处理。

nohup brew doctor > log.log

第一个问题比较简单,并且也有一个相对简单的解决方案,即: brew prune

Warning: Broken symlinks were found. Remove them with `brew prune`:
    /usr/local/bin/2to3-3.4
    /usr/local/bin/N1
    /usr/local/bin/TexturePacker
    /usr/local/bin/aclocal
    /usr/local/bin/aclocal-1.14
    /usr/local/bin/automake

于是,便执行了这个命令:

brew prune

然后遇到了权限问题:

Error: Permission denied - /usr/local/share/ghostscript/9.16/Resource/CIDFont/HiraKakuPro-W3

就可以用下面的命令来解决这个问题了:

sudo chown -R "$USER":admin /usr/local

随后,终于成功修复了第一个问题。

Pruned 484 symbolic links and 317 directories from /usr/local

接着,遇到一系列的多出来的库的问题:

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
    /usr/local/lib/libffi.6.dylib
    /usr/local/lib/libjlinkpic32.4.90.1.dylib
    /usr/local/lib/libmcrypt.4.4.8.dylib

删除之:

rm /usr/local/lib/libmcrypt.4.4.8.dylib

以及多出来的头文件:

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
    /usr/local/include/Extras/OVR_Math.h
    /usr/local/include/Kernel/OVR_Alg.h
    /usr/local/include/Kernel/OVR_Allocator.h

还有la文件:

Warning: Unbrewed .la files were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .la files:
    /usr/local/lib/libffi.la
    /usr/local/lib/libmcrypt.la

pc文件:

Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .pc files:
    /usr/local/lib/pkgconfig/glfw3.pc

以及静态库:

Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected static libraries:
    /usr/local/lib/libappfirewall.a
    /usr/local/lib/libautoblock.a

接着就是修复一些没有link的库的问题了:

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:
    binutils
    erlang
    gcc
    gnutls
brew link binutils                                                                                                        
Linking /usr/local/Cellar/binutils/2.25.1...
Error: Could not symlink share/info/bfd.info
Target /usr/local/share/info/bfd.info
is a symlink belonging to gdb. You can unlink it:
  brew unlink gdb

To force the link and overwrite all conflicting files:
  brew link --overwrite binutils

To list all files that would be deleted:
  brew link --overwrite --dry-run binutils

重新安装之:

brew uninstall binutils
brew install binutils

还有一个更有意思的问题,这时候只好一个个的将这些第三方库清空:

Error: uninitialized constant AbstractPhpVersion::Php70Defs
Please report this bug:
    https://git.io/brew-troubleshooting
/usr/local/Library/Taps/homebrew/homebrew-php/Abstract/abstract-php-extension.rb:216:in `<class:AbstractPhp70Extension>'
/usr/local/Library/Taps/homebrew/homebrew-php/Abstract/abstract-php-extension.rb:215:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in 

先删了再说:

rm -rf /usr/local/Library/Taps/josegonzalez/homebrew-php

还有需要安装的依赖

Warning: Some installed formula are missing dependencies.
You should `brew install` the missing dependencies:

    brew install docker-machine hicolor-icon-theme ocaml qt qt5

不需要的依赖:

You may wish to `brew unlink` these brews:
    libxml2
    libxslt
    openssl
    homebrew/versions/tomcat6

以及一些配置问题——即在$PATH后面多了一个"/"

Warning: Some directories in your path end in a slash.
Directories in your path should not end in a slash. This can break other
doctor checks. The following directories should be edited:
    /Users/fdhuang/gocode/bin/
    /usr/local/sbin/
    /usr/local/gcc_arm/gcc-arm-none-eabi-4_8-2014q3/bin/
    /Library/TeX/texbin/

然后执行

brew update                                                                                                                                                       

又有一堆错误:

error: refs/remotes/origin/gh-pages does not point to a valid object!
error: refs/remotes/origin/gnome-releases does not point to a valid object!
error: refs/remotes/origin/go does not point to a valid object!
error: refs/remotes/origin/gh-pages does not point to a valid object!
error: refs/remotes/origin/gnome-releases does not point to a valid object!
error: refs/remotes/origin/go does not point to a valid object!

关于我

Github: @phodal     微博:@phodal     知乎:@phodal    

微信公众号(Phodal)

围观我的Github Idea墙, 也许,你会遇到心仪的项目

QQ技术交流群: 321689806
comment

Feeds

RSS / Atom

最近文章

关于作者

Phodal Huang

Engineer, Consultant, Writer, Designer

ThoughtWorks 技术专家

工程师 / 咨询师 / 作家 / 设计学徒

开源深度爱好者

出版有《前端架构:从入门到微前端》、《自己动手设计物联网》、《全栈应用开发:精益实践》

联系我: h@phodal.com

微信公众号: 最新技术分享

标签