How to avoid “cannot load such file — utils/popen” from homebrew on OSX

前端 未结 9 1560
余生分开走
余生分开走 2020-11-29 14:48

I\'m getting an error when I run brew in the terminal:

 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core         


        
相关标签:
9条回答
  • 2020-11-29 15:01

    After updating to El Capitan, /usr/local has root:wheel rights.

    Change the rights back to the user using:

    sudo chown -R $(whoami):admin /usr/local
    

    and:

    brew doctor && brew update
    

    This helped me to get Homebrew working again.

    0 讨论(0)
  • 2020-11-29 15:10

    First, open a terminal session and run:

    cd /usr/local/
    git status
    

    to see if Homebrew is clean.

    If it's dirty, run:

    git reset --hard && git clean -df
    

    then

    brew doctor
    brew update
    

    If it's still broken, try this in your session:

    sudo rm /System/Library/Frameworks/Ruby.framework/Versions/Current
    sudo ln -s /System/Library/Frameworks/Ruby.framework/Versions/1.8 /System/Library/Frameworks/Ruby.framework/Versions/Current
    

    This will force Homebrew to use Ruby 1.8 from the system's installation.

    0 讨论(0)
  • 2020-11-29 15:10

    This issue should be fixed in the newest version of Homebrew. Try reinstalling it, which is described on the Homebrew home page.

    0 讨论(0)
  • 2020-11-29 15:12

    Uninstall homebrew:

     ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
    

    Then reinstall

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    

    Warning: This script will remove: /Library/Caches/Homebrew/ - thks benjaminsila

    0 讨论(0)
  • 2020-11-29 15:14

    The problem mainly occurs after updating OS X to El Capitan (OS X 10.11) or macOS Sierra (macOS 10.12).

    This is because of file permission issues with El Capitan’s or later macOS's new SIP process. Try changing the permissions for the /usr/local directory:

    $ sudo chown -R $(whoami):admin /usr/local  
    

    If it still doesn't work, use these steps inside a terminal session and everything will be fine:

    cd /usr/local/Library/Homebrew  
    git reset --hard  
    git clean -df
    brew update
    

    This may be because homebrew is not updated.

    0 讨论(0)
  • 2020-11-29 15:16

    In my case I just needed to remove Homebrew's executable using:

    sudo rm -f `which brew`
    

    Then reinstall Homebrew:

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    
    0 讨论(0)
提交回复
热议问题