V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Showfom
V2EX  ›  macOS

10.11.1 如何升级 zsh 和 homebrew?

  •  
  •   Showfom · 2015-10-27 15:16:43 +08:00 · 5792 次点击
    这是一个创建于 3349 天前的主题,其中的信息可能已经有所发展或是发生改变。
    一升级就提示失败, homebrew 目前也用不了,现在有解决的方法了吗?
    13 条回复    2015-10-28 09:34:42 +08:00
    Showfom
        1
    Showfom  
    OP
       2015-10-27 15:22:36 +08:00
    然而执行了 doctor 给的建议并没鸟用

    ➜ Showfom@rMBP ~ brew update
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
    Error: Failure while executing: git checkout -q master
    ➜ Showfom@rMBP ~ brew doctor
    Please note that these warnings are just used to help the Homebrew maintainers
    with debugging if you file an issue. If everything you use Homebrew for is
    working fine: please don't worry and just ignore them. Thanks!

    Warning: The /usr/local directory is not writable.
    Even if this directory was writable when you installed Homebrew, other
    software may change permissions on this directory. Some versions of the
    "InstantOn" component of Airfoil are known to do this.

    You should probably change the ownership and permissions of /usr/local
    back to your user account.
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

    Warning: You have an outdated version of /usr/bin/install_name_tool installed.
    This will cause binary package installations to fail.
    This can happen if you install osx-gcc-installer or RailsInstaller.
    To restore it, you must reinstall OS X or restore the binary from
    the OS packages.

    Warning: Git could not be found in your PATH.
    Homebrew uses Git for several internal functions, and some formulae use Git
    checkouts instead of stable tarballs. You may want to install Git:
    brew install git

    Warning: No developer tools installed.
    Install the Command Line Tools:
    xcode-select --install
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

    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

    Warning: Your Xcode is configured with an invalid path.
    You should change it to the correct path:
    sudo xcode-select -switch /Developer
    xlvecle
        2
    xlvecle  
       2015-10-27 15:23:58 +08:00
    重新安装 xcode-tools
    royzheng
        3
    royzheng  
       2015-10-27 15:27:03 +08:00
    cd $(brew --prefix)
    git fetch origin
    git reset --hard origin/master
    brew update
    g67261831
        4
    g67261831  
       2015-10-27 15:29:02 +08:00
    提示的错误原因不是很明显吗。
    g67261831
        5
    g67261831  
       2015-10-27 15:29:40 +08:00
    重装 xcode-tools ,修改 /usr/local 权限。
    Showfom
        6
    Showfom  
    OP
       2015-10-27 15:34:03 +08:00
    @xlvecle 重装了
    Sylv
        8
    Sylv  
       2015-10-27 16:20:32 +08:00 via iPhone
    sudo chown -R $(whoami):admin /usr/local
    pagict
        9
    pagict  
       2015-10-27 16:42:21 +08:00
    我是格盘重来的
    Showfom
        10
    Showfom  
    OP
       2015-10-27 17:29:01 +08:00
    @Sylv 好了,终于搞定
    lonelygo
        11
    lonelygo  
       2015-10-27 17:37:29 +08:00
    顺着问题我也问一个:
    brew update && brew upgrade
    以前执行就是直接出 update 和 upgrade 结果,现在变成这样:
    Updated Homebrew from b3707d2a to 185815a5.
    Stashing your changes:
    M .editorconfig
    M .gitignore
    M .rspec
    M .rubocop.yml
    M .rubocop_todo.yml

    M 为红色的,别的貌似都正常。
    如何才能让 M 开头的这些都没有呢?实在太长了。。。
    cnhongwei
        12
    cnhongwei  
       2015-10-27 23:42:20 +08:00   ❤️ 1
    @lonelygo 应该是你的 homebrew 程序文件被修改了。你到 /usr/local 目录中,使用 git status 看一下是为什么,一般放弃修改你使用 "git checkout -- ." 就可以了。
    lonelygo
        13
    lonelygo  
       2015-10-28 09:34:42 +08:00
    @cnhongwei
    ➜ /usr/local (master ✔) > git status
    On branch master
    nothing to commit, working directory clean

    貌似 git 没啥问题丫
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5364 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 07:27 · PVG 15:27 · LAX 23:27 · JFK 02:27
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.