memo.xight.org

日々のメモ

brew update で syntax error

Summary

brew update で syntax errorが発生。
brew doctor を実行しても同様のエラー。

$ brew update
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch' to see the failed patch
unable to refresh index
/usr/local/Homebrew/Library/Homebrew/load_path.rb:9:in `require': /usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/setup.rb:47: syntax error, unexpected <<, expecting end-of-input (SyntaxError)
<<<<<<< HEAD
  ^
        from /usr/local/Homebrew/Library/Homebrew/load_path.rb:9:in `<top (required)>'
        from /usr/local/Homebrew/Library/Homebrew/global.rb:10:in `require_relative'
        from /usr/local/Homebrew/Library/Homebrew/global.rb:10:in `<top (required)>'
        from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `require_relative'
        from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `<main>'

対処: brew update-reset

$ brew update-reset
==> Fetching /usr/local/Homebrew...
remote: Enumerating objects: 45, done.
remote: Counting objects: 100% (45/45), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 5 (delta 4), reused 3 (delta 2), pack-reused 0
Unpacking objects: 100% (5/5), done.
From https://github.com/Homebrew/brew
 * [new branch]          dependabot/bundler/Library/Homebrew/rubocop-performance-1.3.0 -> origin/dependabot/bundler/Libr
ary/Homebrew/rubocop-performance-1.3.0

==> Resetting /usr/local/Homebrew...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Switched to and reset branch 'master'
Your branch is up to date with 'origin/master'.

Reference

Homebrew Community Discussion - 2019-03-04 - Brew ruby load error
https://discourse.brew.sh/t/brew-ruby-load-error/4309/4

Stack overflow - 2019-03-03 - Homebrew broken - "cannot load such file — vendor/bundle/bundler/setup (LoadError)"
https://stackoverflow.com/questions/54848319/homebrew-broken-cannot-load-such-file-vendor-bundle-bundler-setup-loaderr