mac brew

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

接着就是修复一些没有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



作者:39Coding
链接:https://www.jianshu.com/p/673b7c05e0cd
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
posted @ 2024-09-15 20:34  YZFHKMS-X  阅读(18)  评论(0编辑  收藏  举报