美文网首页mac使用
解决Mac OSX系统版本安装brew出错

解决Mac OSX系统版本安装brew出错

作者: Springer | 来源:发表于2016-04-09 00:52 被阅读10117次

    上周更新了最新的Mac OSX操作系统10.11.x,但是安装brew命令的时候出现如下两种错误:

    fatal: cannot unlink 'Library/Aliases/0install': Permission denied
    
    error: unable to unlink old 'share/doc/homebrew/Acceptable-Formulae.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/Bottles.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/Brew-Test-Bot-For-Core-Contributors.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/Brew-Test-Bot.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/C++-Standard-Libraries.md' (Permission denied)
    error: unable to create file share/doc/homebrew/Checksum_Deprecation.md (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/Common-Issues-for-Core-Contributors.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/Common-Issues.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/Custom-GCC-and-cross-compilers.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/External-Commands.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/FAQ.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/Formula-Cookbook.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/Gems,-Eggs-and-Perl-Modules.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/Homebrew-and-Python.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/How-To-Open-a-Homebrew-Pull-Request-(and-get-it-merged).md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/How-to-Create-and-Maintain-a-Tap.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/How-to-build-software-outside-Homebrew-with-Homebrew-keg-only-dependencies.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/Installation.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/Interesting-Taps-&-Branches.md' (Permission denied)
    error: unable to create file share/doc/homebrew/Kickstarter-Supporters.md (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/Maintainer-Guidelines.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/Migrating-A-Formula-To-A-Tap.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/New-Maintainer-Checklist.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/Python-for-Formula-Authors.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/Querying-Brew.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/README.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/Rename-A-Formula.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/Tips-N'-Tricks.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/Troubleshooting.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/Xcode.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/brew-tap.md' (Permission denied)
    error: unable to unlink old 'share/doc/homebrew/brew.1.html' (Permission denied)
    fatal: cannot create directory at 'share/doc/homebrew/images': Permission denied
    

    网上找了半天找到了此种方法stackoverflow.此方法给我了一些提示,解决了OSX系统中brew的安装。

    1.clone brew项目到本地

    git clone https://github.com/Homebrew/brew
    

    2.移动项目文件

    在执行文件的移动之前,请保证要移动到的目录文件中的相同文件移除

    1).通过本地项目可知brew的目录结构,而我们所使用的命令都是/usr/local/bin文件中,因此将brew中的bin目录下的命令brew拷贝或者移动到/usr/local/bin下:(我所使用的是移动)
    //进入本地项目brew中
    cd brew 
    //移动brew到系统文件中
    sudo mv bin/brew /usr/local/bin
    
    2).移动Library
    //移动Library库到/usr/local
    sudo mv Library /usr/local
    
    3).移动share文件
    //移动share库到/usr/local
    sudo mv share /usr/local
    

    3.查看是否安装成功

    使用brew查看是否已经移动成功.如果有以下内容则代表成功。


    到此为止,我们可以运行brew update更新brew,以及brew install来安装我们所要使用的工具

    ps:转载请注明出处

    相关文章

      网友评论

        本文标题:解决Mac OSX系统版本安装brew出错

        本文链接:https://www.haomeiwen.com/subject/eqavlttx.html