解决Mac OSX系统版本安装brew出错:error: unable to unlink old

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

  • 问题原因:更新了最新的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就不全部粘出来了

  • 问题解决思路,既然用命令不能自动完成安装,那我们就手动将需要的文件放在指定目录中:

    • 正常情况这条命令就能安装成功:
      /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • 解决步骤:
    1.clone brew 项目到本地,目录随意,只要自己能找到
    git clone https://github.com/Homebrew/brew

    2.移动项目文件
    在执行文件的移动之前,先将/usr/local/ 中,Library、share目录删除

    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

    查看是否已经移动成功.如果有以下内容则代表成功。
    解决Mac OSX系统版本安装brew出错:error: unable to unlink old_第1张图片
    到此为止,我们可以运行brew update更新brew,以及brew install来安装我们所要使用的工具

@晴--2016-08-16 15:48:08

你可能感兴趣的:(解决Mac OSX系统版本安装brew出错:error: unable to unlink old)