広告 Mac

brew update 失敗時の対処法

brew update を実行したところ下記のエラーが発生

$ sudo brew update                                                                                                                                                                
error: Your local changes to the following files would be overwritten by merge:
     .gitignore
     CODEOFCONDUCT.md
     CONTRIBUTING.md
     LICENSE.txt
     Library/Contributions/brew_bash_completion.sh
     Library/Contributions/brew_fish_completion.fish
     Library/Contributions/brew_zsh_completion.zsh
     Library/Contributions/example-formula.rb
     Library/ENV/4.3/bsdmake
     Library/ENV/4.3/cc
     Library/ENV/4.3/git
     Library/ENV/4.3/pod2man
     Library/ENV/4.3/svn
     Library/Formula/a2ps.rb
     Library/Formula/aalib.rb
     Library/Formula/abcde.rb
     Library/Formula/abcm2ps.rb
     Library/Formula/abcmidi.rb
     Library/Formula/abnfgen.rb
     Library/Formula/ace.rb
     Library/Formula/ack.rb
     Library/Formula/acme.rb
     Library/Formula/acpica.rb
     Library/Formula/activemq-cpp.rb
     Library/Formula/adns.rb
     Library/Formula/adobe-air-sdk.rb
     Library/Formula/aescrypt.rb
     Library/Formula/afflib.rb
     Library/Formula/afsctool.rb
     Library/Formula/aget.rb
     Library/Formula/aha.rb
     Library/Formula/aircrack-ng.rb
     Library/Formula/akka.rb
     Library/Formula/align.rb
     Library/Formula/alpine.rb
     Library/Formula/amap.rb
     Library/Formula/amtterm.rb
     Library/Formula/analog.rb
     Library/Formula/android-ndk.rb
     Library/Formula/android-platform-tools.rb
     Library/Formula/android-sdk.rb
     Library/Formula/ansible.rb
     Library/Formula/ansifilter.rb
     Library/Formula/ant.rb
     Library/Formula/antlr.rb
     Library/Formula/apache-spark.rb
     Library/Formula/ape.rb
     Library/Formula/apgdiff.rb
     Library/Formula/apib.rb
     Library/Formula/apngasm.rb
     Library/Formula/app-engine-java-sdk.rb
     Library/Formula/appscale-tools.rb
     Library/Formula/aqbanking.rb
     Library/Formula/arabica.rb
     Library/Formula/arangodb.rb
     Library/Formula/argp-standalone.rb
     Library/Formula/argus-clients.rb
     Library/Formula/argus.rb
     Library/Formula/aria2.rb
     Library/Formula/arp-scan.rb
     Library/Formula/asciidoc.rb
     Library/Formula/asn1c.rb
     Library/Formula/aspell.rb
     Library/Formula/assimp.rb
     Library/Formula/astyle.rb
     Library/Formula/at-spi2-atk.rb
     Library/Formula/at-spi2-core.rb
     Library/Formula/atf.rb
     Library/Formula/atk.rb
     Library/Formula/atomicparsley.rb
     Library/Formula/atool.rb
     Library/Formula/ats2-postiats.rb
     Library/Formula/aubio.rb
     Library/Formula/auctex.rb
     Library/Formula/audiofile.rb
     Library/Formula/augeas.rb
     Library/Formula/auto-scaling.rb
     Library/Formula/autoconf-archive.rb
     Library/Formula/autoconf.rb
     Library/Formula/autoenv.rb
     Library/Formula/autogen.rb
     Library/Formula/autojump.rb
     Library/Formula/automake.rb
     Library/Formula/autossh.rb
     Library/Formula/avfs.rb
     Library/Formula/avian.rb
     Library/Formula/avidemux.rb
     Library/Formula/avra.rb
     Library/Formula/aws-cfn-tools.rb
     Library/Formula/aws-elasticache.rb
     Library/Formula/aws-elasticbeanstalk.rb
     Library/Formula/aws-sns-cli.rb
     Library/Formula/awscli.rb
     Library/Formula/axel.rb
     Library/Formula/b43-fwcutter.rb
     Library/Formula/babeld.rb
     Library/Formula/babl.rb
     Library/Formula/bacula-fd.rb
     Library/Formula/bam.rb
     Library/Formula/bash-git-prompt.rb
     Library/Formula/bash.rb
     Library/Formula/bashdb.rb
     Library/Formula/bashish.rb
     Library/Formula/bats.rb
     Library/Formula/bazaar.rb
     Library/Formula/bbftp-client.rb
     Library/Formula/bchunk.rb
     Library/Formula/bcpp.rb
     Library/Formula/bcrypt.rb
     Library/Formula/bdw-gc.rb
     Library/Formula/beecrypt.rb
     Library/Formula/berkeley-db.rb
     Library/Formula/berkeley-db4.rb
     Library/Formula/betty.rb
     Library/Formula/bfg.rb
     Library/Formula/bib-tool.rb
     Library/Formula/bibtex2html.rb
     Library/Formula/bibutils.rb
     Library/Formula/bind.rb
     Library/Formula/binutils.rb
     Library/Formula/binwalk.rb
     Library/Formula/bip.rb
     Library/Formula/bison.rb
     Library/Formula/bitchx.rb
     Library/Formula/bitlbee.rb
     Library/Formula/blink1.rb
     Library/Formula/blitz.rb
     Library/Formula/blueutil.rb
     Library/Formula/bmon.rb
     Library/Formula/boost-bcp.rb
     Library/Formula/boost-build.rb
     Library/Formula/boost-python.rb
     Library/Formula/boost.rb
     Library/Formula/boot2docker.rb
     Library/Formula/botan.rb
     Library/Formula/boxes.rb
     Library/Formula/bpm-tools.rb
     Library/Formula/brew-gem.rb
     Library/Formula/bro.rb
     Library/Formula/bsdiff.rb
     Library/Formula/bsdmake.rb
     Library/F
error: The following untracked working tree files would be overwritten by merge:
     .yardopts
     Library/.rubocop.yml
     Library/Aliases/actor-framework
     Library/Aliases/libcaf
     Library/Aliases/libgme
     Library/Aliases/nim
     Library/ENV/pkgconfig/10.6/sqlite3.pc
     Library/ENV/pkgconfig/10.6/zlib.pc
     Library/ENV/pkgconfig/10.7/sqlite3.pc
     Library/ENV/pkgconfig/10.7/zlib.pc
     Library/ENV/pkgconfig/10.8/sqlite3.pc
     Library/ENV/pkgconfig/10.8/zlib.pc
     Library/ENV/scm/git
     Library/ENV/scm/svn
     Library/Formula/abduco.rb
     Library/Formula/abi-compliance-checker.rb
     Library/Formula/aescrypt-packetizer.rb
     Library/Formula/afl-fuzz.rb
     Library/Formula/apr-util.rb
     Library/Formula/apr.rb
     Library/Formula/aptly.rb
     Library/Formula/arpon.rb
     Library/Formula/artifactory.rb
     Library/Formula/asciinema.rb
     Library/Formula/baresip.rb
     Library/Formula/blucat.rb
     Library/Formula/bwctl.rb
     Library/Formula/camlp4.rb
     Library/Formula/carthage.rb
     Library/Formula/cctools.rb
     Library/Formula/chapel.rb
     Library/Formula/chinadns-c.rb
     Library/Formula/clang-format.rb
     Library/Formula/closure-linter.rb
     Library/Formula/commonmark.rb
     Library/Formula/cpp-netlib.rb
     Library/Formula/cproto.rb
     Library/Formula/ctunnel.rb
     Library/Formula/davmail.rb
     Library/Formula/deis.rb
     Library/Formula/distribution.rb
     Library/Formula/dnscrypt-wrapper.rb
     Library/Formula/dsd.rb
     Library/Formula/duck.rb
     Library/Formula/ebook-tools.rb
     Library/Formula/epeg.rb
     Library/Formula/euler-py.rb
     Library/Formula/fabric.rb
     Library/Formula/ffts.rb
     Library/Formula/fibjs.rb
     Library/Formula/finatra.rb
     Library/Formula/flow.rb
     Library/Formula/game-music-emu.rb
     Library/Formula/gammaray.rb
     Library/Formula/gauge.rb
     Library/Formula/gdnsd.rb
     Library/Formula/gifify.rb
     Library/Formula/git-review.rb
     Library/Formula/gitfs.rb
     Library/Formula/glbinding.rb
     Library/Formula/glide.rb
     Library/Formula/gnatsd.rb
     Library/Formula/groovysdk.rb
     Library/Formula/gtkextra.rb
     Library/Formula/h2o.rb
     Library/Formula/hardlink-osx.rb
     Library/Formula/hashcash.rb
     Library/Formula/hh.rb
     Library/Formula/i2util.rb
     Library/Formula/icdiff.rb
     Library/Formula/id3ed.rb
     Library/Formula/idris.rb
     Library/Formula/ios-class-guard.rb
     Library/Formula/jenv.rb
     Library/Formula/jooby-bootstrap.rb
     Library/Formula/jrnl.rb
     Library/Formula/jsoncpp.rb
     Library/Formula/julius.rb
     Library/Formula/kore.rb
     Library/Formula/kyua.rb
     Library/Formula/lastpass-cli.rb
     Library/Formula/libbpg.rb
     Library/Formula/libgit2-glib.rb
     Library/Formula/libgroove.rb
     Library/Formula/libhdhomerun.rb
     Library/Formula/libiomp.rb
     Library/Formula/libjson-rpc-cpp.rb
     Library/Formula/libmarisa.rb
     Library/Formula/libpointing.rb
     Library/Formula/libsoxr.rb
     Library/Formula/lsh.rb
     Library/Formula/ltl2ba.rb
     Library/Formula/lutok.rb
     Library/Formula/makefile2graph.rb
     Library/Formula/mdp.rb
     Library/Formula/megatools.rb
     Library/Formula/memo.rb
     Library/Formula/mitie.rb
     Library/Formula/moco.rb
     Library/Formula/mvnvm.rb
     Library/Formula/mvptree.rb
     Library/Formula/mysql-sandbox.rb
     Library/Formula/nailgun.rb
     Library/Formula/nave.rb
     Library/Formula/nikto.rb
     Library/Formula/nut.rb
     Library/Formula/odo.rb
     Library/Formula/odt2txt.rb
     Library/Formula/open-zwave.rb
     Library/Formula/openh264.rb
     Library/Formula/osquery.rb
     Library/Formula/pcsc-lite.rb
     Library/Formula/perl.rb
     Library/Formula/pgcli.rb
     Library/Formula/pinentry-mac.rb
     Library/Formula/powerman.rb
     Library/Formula/pup.rb
     Library/Formula/pwntools.rb
     Library/Formula/queequeg.rb
     Library/Formula/rbenv-bundle-exec.rb
     Library/Formula/rbenv-bundler-ruby-version.rb
     Library/Formula/redshift.rb
     Library/Formula/restund.rb
     Library/Formula/rgbds.rb
     Library/Formula/rmate.rb
     Library/Formula/rocket.rb
     Library/Formula/scalastyle.rb
     Library/Formula/signify-osx.rb
     Library/Formula/simple-amqp-client.rb
     Library/Formula/skinny.rb
     Library/Formula/smali.rb
     Library/Formula/snappystream.rb
     Library/Formula/snow.rb
     Library/Formula/speech-tools.rb
     Library/Formula/spoof-mac.rb
     Library/Formula/src.rb
     Library/Formula/sslmate.rb
     Library/Formula/stlink.rb
     Library/Formula/stoken.rb
     Library/Formula/subl
Aborting
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master

対処法

以下のコマンドを走らせて解決しました。

$ cd `brew --prefix`
$ sudo git fetch origin
$ sudo git reset --hard origin/master

Sponsor Link

-Mac