No such keg: /usr/local/Cellar/git

后端 未结 3 1414
清歌不尽
清歌不尽 2020-12-04 17:48

I have been struggling with this for a few hours. I am on a Mac using Yosemite. I had homebrew installed, and was using git just fine. I tried doing $git add -i

相关标签:
3条回答
  • 2020-12-04 18:05

    Os X Mojave 10.14 has:

    Error: The Command Line Tools header package must be installed on Mojave.

    Solution. Go to

    /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

    location and install the package manually. And brew will start working and we can run:

    brew uninstall --force git
    brew cleanup --force -s git
    brew prune
    brew install git
    
    0 讨论(0)
  • 2020-12-04 18:22

    Give another go at force removing the brewed version of git

    brew uninstall --force git
    

    Then cleanup any older versions and clear the brew cache

    brew cleanup -s git
    

    Remove any dead symlinks

    brew cleanup --prune-prefix
    

    Then try reinstalling git

    brew install git
    

    If that doesn't work, I'd remove that installation of Homebrew altogether and reinstall it. If you haven't placed anything else in your brew --prefix directory (/usr/local by default), you can simply rm -rf $(brew --prefix). Otherwise the Homebrew wiki recommends using a script at https://gist.github.com/mxcl/1173223#file-uninstall_homebrew-sh

    0 讨论(0)
  • 2020-12-04 18:27

    Had a similar issue while installing "Lua" in OS X using homebrew. I guess it could be useful for other users facing similar issue in homebrew.

    On running the command:

    $ brew install lua

    The command returned an error:

    Error: /usr/local/opt/lua is not a valid keg
    (in general the error can be of /usr/local/opt/ is not a valid keg

    FIXED it by deleting the file/directory it is referring to, i.e., deleting the "/usr/local/opt/lua" file.

    root-user # rm -rf /usr/local/opt/lua

    And then running the brew install command returned success.

    0 讨论(0)
提交回复
热议问题