Skip to content
This repository

Cannot "brew update" anymore - fails to git pull formulas #11448

Closed
MPV opened this Issue April 04, 2012 · 50 comments
Victor
MPV commented April 04, 2012

EDIT: The TLDR solution:

cd `brew --prefix`
git remote add origin https://github.com/mxcl/homebrew.git
git fetch origin
git reset --hard origin/master

The story behind it:

Hi,
Recently I started getting this output when I run "brew update".
I can't recall having done anything special that would affect my homebrew installation.

$ brew update
error: Your local changes to the following files would be overwritten by merge:
    Library/Aliases/bjam
    Library/Aliases/gpg2
    Library/Contributions/brew_bash_completion.sh
    Library/Contributions/manpages/brew.1.md
    Library/Formula/a2ps.rb
    Library/Formula/aalib.rb
    Library/Formula/abcde.rb
    Library/Formula/abiword.rb
    Library/Formula/abook.rb
    Library/Formula/abuse.rb
    Library/Formula/ace.rb
    Library/Formula/ack.rb
    Library/Formula/activemq.rb
    Library/Formula/adobe-air-sdk.rb
    Library/Formula/advancecomp.rb
    Library/Formula/aescrypt.rb
    Library/Formula/afsctool.rb
    Library/Formula/aften.rb
    Library/Formula/aget.rb
    Library/Formula/aggregate.rb
    Library/Formula/agrep.rb
    Library/Formula/aircrack-ng.rb
    Library/Formula/aldo.rb
    Library/Formula/algol68g.rb
    Library/Formula/alpine.rb
    Library/Formula/amap.rb
    Library/Formula/android-sdk.rb
    Library/Formula/ann.rb
    Library/Formula/ansifilter.rb
    Library/Formula/antiword.rb
    Library/Formula/antlr.rb
    Library/Formula/anttweakbar.rb
    Library/Formula/aoeui.rb
    Library/Formula/apg.rb
    Library/Formula/apgdiff.rb
    Library/Formula/apiextractor.rb
    Library/Formula/apktool.rb
    Library/Formula/aplus.rb
    Library/Formula/app-engine-java-sdk.rb
    Library/Formula/apt-dater.rb
    Library/Formula/aqbanking.rb
    Library/Formula/arabica.rb
    Library/Formula/aria2.rb
    Library/Formula/arm.rb
    Library/Formula/armadillo.rb
    Library/Formula/arping.rb
    Library/Formula/arss.rb
    Library/Formula/assimp.rb
    Library/Formula/astyle.rb
    Library/Formula/asymptote.rb
    Library/Formula/aterm.rb
    Library/Formula/atk.rb
    Library/Formula/atlassian-plugin-sdk.rb
    Library/Formula/atomicparsley.rb
    Library/Formula/atool.rb
    Library/Formula/auctex.rb
    Library/Formula/audiofile.rb
    Library/Formula/authexec.rb
    Library/Formula/auto-scaling.rb
    Library/Formula/autobench.rb
    Library/Formula/autogen.rb
    Library/Formula/automoc4.rb
    Library/Formula/autossh.rb
    Library/Formula/aview.rb
    Library/Formula/avra.rb
    Library/Formula/avro-c.rb
    Library/Formula/aws-cfn-tools.rb
    Library/Formula/aws-elasticache.rb
    Library/Formula/aws-iam-tools.rb
    Library/Formula/babl.rb
    Library/Formula/bagit.rb
    Library/Formula/bali-phy.rb
    Library/Formula/bash-completion.rb
    Library/Formula/bazaar.rb
    Library/Formula/bbcp.rb
    Library/Formula/bcrypt.rb
    Library/Formula/bcwipe.rb
    Library/Formula/bdw-gc.rb
    Library/Formula/beanstalk.rb
    Library/Formula/bedtools.rb
    Library/Formula/berkeley-db.rb
    Library/Formula/bibutils.rb
    Library/Formula/binutils.rb
    Library/Formula/binwalk.rb
    Library/Formula/bitlbee.rb
    Library/Formula/blahtexml.rb
    Library/Formula/blast.rb
    Library/Formula/blitz.rb
    Library/Formula/blueutil.rb
    Library/Formula/boost.rb
    Library/Formula/botan.rb
    Library/Formula/box2d.rb
    Library/Formula/boxes.rb
    Library/Formula/bsdiff.rb
    Library/Formula/bulk_extractor.rb
    Library/Formula/bwa.rb
    Library/Formula/bwm-ng.rb
    Library/Formula/byobu.rb
    Library/Formula/c10t.rb
    Library/Formula/cabal-install.rb
    Library/Formula/cadaver.rb
    Library/Formula/cairo.rb
    Library/Formula/cairomm.rb
    Library/Formula/calabash.rb
    Library/Formula/cantera.rb
    Library/Formula/cassandra.rb
    Library/Formula/cc65.rb
    Library/Formula/cdargs.rb
    Library/Formula/cdecl.rb
    Library/Formula/cdrdao.rb
    Library/Formula/ceylon.rb
    Library/Formula/cfengine.rb
    Library/Formula/cfitsio.rb
    Library/Formula/cgal.rb
    Library/Formula/cgdb.rb
    Library/Formula/cheops.rb
    Library/Formula/chibi-scheme.rb
    Library/Formula/chipmunk.rb
    Library/Formula/chkrootkit.rb
    Library/Formula/chromaprint.rb
    Library/Formula/cimg.rb
    Library/Formula/clay.rb
    Library/Formula/clisp.rb
    Library/Formula/cloc.rb
    Library/Formula/closure-compiler.rb
    Library/Formula/cloud-watch.rb
    Library/Formula/cloudbees-sdk.rb
    Library/Formula/clozure-cl.rb
    Library/Formula/clucene.rb
    Library/Formula/clusterit.rb
    Library/Formula/clutter.rb
    Library/Formula/cmake.rb
    Library/Formula/cmigemo.rb
    Library/Formula/cminpack.rb
    Library/Formula/cmu-pocketsphinx.rb
    Library/Formula/cmu-sphinxbase.rb
    Library/Formula/cmucl.rb
    Library/Formula/cmus.rb
    Library/Formula/coffee-script.rb
    Library/Formula/collectd.rb
    Library/Formula/co
error: The following untracked working tree files would be overwritten by merge:
    Library/Aliases/boost-jam
    Library/Aliases/fastcgi
    Library/Aliases/nodejs
    Library/Aliases/pocketsphinx
    Library/Aliases/sphinxbase
    Library/Contributions/cmds/brew-beer.rb
    Library/Contributions/cmds/brew-dirty.rb
    Library/Contributions/cmds/brew-graph
    Library/Contributions/cmds/brew-grep
    Library/Contributions/cmds/brew-leaves.rb
    Library/Contributions/cmds/brew-linkapps.rb
    Library/Contributions/cmds/brew-man
    Library/Contributions/cmds/brew-mirror-check.rb
    Library/Contributions/cmds/brew-missing.rb
    Library/Contributions/cmds/brew-pull.rb
    Library/Contributions/cmds/brew-readall.rb
    Library/Contributions/cmds/brew-server
    Library/Contributions/cmds/brew-switch.rb
    Library/Contributions/cmds/brew-unpack.rb
    Library/Contributions/cmds/brew-which.rb
    Library/Contributions/install_homebrew.rb
    Library/Formula/abcl.rb
    Library/Formula/ape.rb
    Library/Formula/apollo.rb
    Library/Formula/appledoc.rb
    Library/Formula/arp-scan.rb
    Library/Formula/atkmm.rb
    Library/Formula/autoconf.rb
    Library/Formula/autoenv.rb
    Library/Formula/autojump.rb
    Library/Formula/automake.rb
    Library/Formula/avocadodb.rb
    Library/Formula/blackbox.rb
    Library/Formula/boost-build.rb
    Library/Formula/bro.rb
    Library/Formula/bsdmake.rb
    Library/Formula/cbmbasic.rb
    Library/Formula/cloog.rb
    Library/Formula/conserver.rb
    Library/Formula/crush-tools.rb
    Library/Formula/dart.rb
    Library/Formula/di.rb
    Library/Formula/dsniff.rb
    Library/Formula/dupx.rb
    Library/Formula/echoping.rb
    Library/Formula/ecm.rb
    Library/Formula/eprover.rb
    Library/Formula/ext2fuse.rb
    Library/Formula/ezlupdate.rb
    Library/Formula/f3.rb
    Library/Formula/fasd.rb
    Library/Formula/fceux.rb
    Library/Formula/fcgi.rb
    Library/Formula/findbugs.rb
    Library/Formula/freerdp.rb
    Library/Formula/funcoeszz.rb
    Library/Formula/gabedit.rb
    Library/Formula/gibbslda.rb
    Library/Formula/git-diffall.rb
    Library/Formula/git-ftp.rb
    Library/Formula/gnu-arch.rb
    Library/Formula/gnumeric.rb
    Library/Formula/gnunet.rb
    Library/Formula/go-app-engine-32.rb
    Library/Formula/go-app-engine-64.rb
    Library/Formula/goffice.rb
    Library/Formula/grace.rb
    Library/Formula/grib-api.rb
    Library/Formula/griffon.rb
    Library/Formula/gtk-doc.rb
    Library/Formula/gtmess.rb
    Library/Formula/hg-flow.rb
    Library/Formula/hqx.rb
    Library/Formula/imap-uw.rb
    Library/Formula/ispell.rb
    Library/Formula/ivy.rb
    Library/Formula/jing.rb
    Library/Formula/knife-completion.rb
    Library/Formula/konoha.rb
    Library/Formula/libcouchbase.rb
    Library/Formula/libcuefile.rb
    Library/Formula/libextractor.rb
    Library/Formula/libgaiagraphics.rb
    Library/Formula/libgnomecanvas.rb
    Library/Formula/libkate.rb
    Library/Formula/libqalculate.rb
    Library/Formula/libreplaygain.rb
    Library/Formula/libtool.rb
    Library/Formula/libvbucket.rb
    Library/Formula/lifelines.rb
    Library/Formula/mdxmini.rb
    Library/Formula/meld.rb
    Library/Formula/minuit2.rb
    Library/Formula/mobile-shell.rb
    Library/Formula/monetdb.rb
    Library/Formula/mp3info.rb
    Library/Formula/mpio.rb
    Library/Formula/msgpack-rpc.rb
    Library/Formula/musepack.rb
    Library/Formula/nacl.rb
    Library/Formula/nauty.rb
    Library/Formula/nrpe.rb
    Library/Formula/num-utils.rb
    Library/Formula/oath-toolkit.rb
    Library/Formula/open-babel.rb
    Library/Formula/orbit.rb
    Library/Formula/par2tbb.rb
    Library/Formula/pcb.rb
    Library/Formula/pdksh.rb
    Library/Formula/perforce-proxy.rb
    Library/Formula/pgdbf.rb
    Library/Formula/phyml.rb
    Library/Formula/pmdmini.rb
    Library/Formula/primesieve.rb
    Library/Formula/pulledpork.rb
    Library/Formula/py2cairo.rb
    Library/Formula/pygobject.rb
    Library/Formula/pygtk.rb
    Library/Formula/quickfix.rb
    Library/Formula/rarian.rb
    Library/Formula/rc.rb
    Library/Formula/riemann.rb
    Library/Formula/rsense.rb
    Library/Formula/sam2p.rb
    Library/Formula/savana.rb
    Library/Formula/sdl_rtf.rb
    Library/Formula/selenium-server-standalone.rb
    Library/Formula/skytools.rb
    Library/Formula/sonar.rb
    Library/Formula/tcpurify.rb
    Library/Formula/the_silver_searcher.rb
    Library/Formula/tkdiff.rb
    Library/Formula/trang.rb
    Librar
Aborting
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master
Victor
MPV commented April 04, 2012

I tried asking the doctor but he was not happy. Where do I even begin?

$ brew doctor
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.

Warning: You have Xcode 4.1, which is outdated.
Please install Xcode 4.3.

Warning: Your Homebrew is outdated
You haven't updated for at least 24 hours, this is a long time in brewland!

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
    /usr/local/lib/libmacfuse_i32.2.dylib    /usr/local/lib/libmacfuse_i64.2.dylib    /usr/local/lib/libosxfuse_i32.2.dylib    /usr/local/lib/libosxfuse_i64.2.dylib    /usr/local/lib/libusb-0.1.4.4.4.dylib    /usr/local/lib/libusbpp-0.1.4.4.4.dylib

Warning: Unbrewed .la files were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .la files:
    /usr/local/lib/libosxfuse_i32.la    /usr/local/lib/libosxfuse_i64.la

Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .pc files:
    /usr/local/lib/pkgconfig/osxfuse.pc

Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built.

    a52dec
    aalib
    atk
    cdparanoia
    check
    cmake
    dirac
    flac
    gdk-pixbuf
    git
    gst-plugins-base
    gst-plugins-good
    gst-plugins-ugly
    gstreamer
    gtk+
    jansson
    jasper
    lame
    libcaca
    libcdio
    libdv
    libdvdcss
    libdvdread
    libevent
    libmms
    libmpdclient
    libmpeg2
    libogg
    liboil
    libshout
    libtiff
    libvorbis
    mad
    mcrypt
    mpc
    mtr
    mysql
    orc
    pango
    php
    pidof
    pkg-config
    popt
    sdl
    speex
    sqlite
    taglib
    theora
    tree
    two-lame
    wget
    xdebug

Warning: You have uncommitted modifications to Homebrew's core.
Unless you know what you are doing, you should run:
  cd /usr/local && git reset --hard

Warning: Some installed formula are missing dependencies.
You should `brew install` the missing dependencies:

    brew install xz pixman cairo yasm x264

Run `brew missing` for more details.

Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:

    git
    git-cvsserver
    git-receive-pack
    git-shell
    git-upload-archive
    git-upload-pack
    gitk
    sqlite3
    svn
    svnadmin
    svndumpfilter
    svnlook
    svnserve
    svnsync
    svnversion

Consider ammending your PATH so that /usr/local/bin
is ahead of /usr/bin in your PATH.

Warning: Homebrew's sbin was not found in your path.
Consider ammending your PATH variable so it contains:
  /usr/local/sbin
Victor
MPV commented April 04, 2012

Oh, and here is the brew env & config:

$ brew --env ; brew --config
CC: /usr/bin/llvm-gcc => /usr/llvm-gcc-4.2/bin/llvm-gcc-4.2
CXX: /usr/bin/llvm-g++ => /usr/llvm-gcc-4.2/bin/llvm-g++-4.2
LD: /usr/bin/llvm-gcc => /usr/llvm-gcc-4.2/bin/llvm-gcc-4.2
CFLAGS: -O3 -w -pipe -march=core2 -msse4.1
CXXFLAGS: -O3 -w -pipe -march=core2 -msse4.1
MAKEFLAGS: -j2
HOMEBREW_VERSION: 0.8.1
HEAD: c3bf616a3d46a6ca72c03db3517dd53d92250511
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
Hardware: dual-core 64-bit penryn
OS X: 10.7.3
Kernel Architecture: x86_64
Ruby: 1.8.7-249
/usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Xcode: 4.1
GCC-4.0: N/A
GCC-4.2: build 5666
LLVM: build 2335
Clang: 2.1 build 163
MacPorts or Fink? false
X11 installed? true
Victor
MPV commented April 04, 2012

Solved by running:

cd `brew --prefix`
git remote add origin https://github.com/mxcl/homebrew.git
git fetch origin
git reset --hard origin/master
Victor MPV closed this April 04, 2012
Anselmo Silva

MPV - Awesome solution.

Aldo Nievas

MVP clap clap !

Rahul Bansal

@MPV worked nicely. Thanks :-)

Andre Luiz Carvalho

Some kind of 'brew update --force' would be very helpful. It would perform exactly this code.

chadcdavis

Agreed @alcarvalho ... the non-existant 'brew update --force' is exactly what I tried before googling.

Thanks for the tip @MPV!

Chia-Ling Lee

@MPV It works! thank you :-)

Gregg Geil

THANK YOU MPV! I have been trying to resolve this for days now!

James Seigel

Awesome

Dennis Gaebel

Yeah that did the trick. Awesome! Thanks for posting the solution.

pekpon

thanks @MPV !!!!!

Carsten Evers

Thanks - worked also for me. :-)

Mike Pack

Perfect, thanks @MPV!

artxgj

Thank you!!!

Ryan L. Cross

Very nice solution! On a side note, I only had to do the following as my origin was already set correctly.

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

I only mention this for posterity sake. For those of you who do not know this, you can check to see what your origin is currently set to with the following:

git remote show origin

Or simply look in your .git/config file in the [remote "origin"] section for the url entry.

That said, it is just as easy to simply use the command from @MPV that I left out (git remote add origin https://github.com/mxcl/homebrew.git) to just explicitly set it. As I mentioned before, I only wrote this out to help those who care to understand more about this, so I hope it helps someone!

Strand McCutchen

@MPV Thanks! Works like a charm!

Rob Aldred

Whilst the solution works, it's not a fix for the cause of the issue. So this continues to happen. Brew changes it's formula files locally for some reason.
I usually brew update whenever I remember probabaly about once a month, I have this issue or similar every time I brew update

The command gives up, surely it could just do this internally without user having to return to this thread everytime.

gkb
gkb commented January 31, 2013

Thank you for clearing this up.

eeldwin

Thanks MPV, awesome solution

Sebastian

Thanks MPV

Kyle Phillips

thanks @MPV!

Asa Baylus

fantastic!

timger

nice

Chris

Another +1. Thanks @MPV!

Joe Conlin

Thanks @MVP. Worked perfectly...

Julien Bourdeau

Great! Thanks a lot!

Johann Pardanaud

Worked for me, thanks!

denislutz

Thx MPV!

Mathias Bynens

Could it be that you guys have a global .gitattributes file that normalizes the line endings in those formulas or something?

jerome budziak

Thanks ! :)

Tom Vincent tlvince referenced this issue from a commit in tlvince/homebrew October 25, 2013
Tom Vincent Normalise line endings, add local .gitattributes
Setting `* text=auto`...

> ... ensures that all files that Git considers to be text will have normalized
> (LF) line endings in the repository
> -- [gitattributes(5)][5]

This should prevent issues such as those discussed in #11448 from cropping up.

See also [h5bp/html5-boilerplate#7f31896][h5bp].

  [5]: http://git-scm.com/docs/gitattributes
  [h5bp]: h5bp/html5-boilerplate@7f31896#commitcomment-525963
9a56eee
Chamnap Chhorn

Thanks :)

Valerie Parham-Thompson

Works! Thank you so much.

Peter Koht

thanks @MVP!

merrick

Thanks!

yaronyosef

thanks MPV!

Luigi De Rosa

Thanks!

wsvincent

Lifesaver. Thanks!

Christof Haemmerle

same here thanks!!!

Spot.IM

thanks

trobbins

Thanks @MPV! Champion of my hour!

Ethan Trawick

2 years later and this still saves me @MPV!

Philip Mannheimer
Preen commented March 24, 2014

@MPV - SWEET THANKS :dancer:

Benny Ng

@MPV nice, it helped me out!

Leon Fedotov

also just:

cd `brew --prefix`; git reset --hard
BitMangler

@MPV...BIG thanks !!!

ajubayer

Hi, I am getting a message
"Your local changes to the following files would be overwritten by merge: mod_python.rb Please commit your changes or stash them before you can merge. Aborting
Error: Failed to update tap: homebrew/apache
"
Anyone have any idea how to fix this issue?

Scenario: i transferred my apps from mac Air to mac Pro using migration utility. then when i started getting some issue with homebrew, I uninstalled and reinstalled homebrew on my mac. every thing else seems to be good and working now but these brew update issue is stopping me from lot other things. can someone help?

Mike McQuaid
Owner

@ajubayer cd $(brew --prefix); git fetch; git reset --hard origin/master (at your own risk)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.