Homebrew / legacy-homebrew

💀 The former home of Homebrew/homebrew (deprecated)
https://brew.sh
26.96k stars 11.35k forks source link

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

Closed MPV closed 12 years ago

MPV commented 12 years ago

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
MPV commented 12 years ago

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
MPV commented 12 years ago

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
MPV commented 12 years ago

Solved by running:

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

MPV - Awesome solution.

alduro commented 12 years ago

MVP clap clap !

rahul286 commented 12 years ago

@MPV worked nicely. Thanks :-)

alcarvalho commented 12 years ago

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

chadcdavis commented 12 years ago

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

Thanks for the tip @MPV!

zerodie commented 12 years ago

@MPV It works! thank you :-)

fender21 commented 12 years ago

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

seigel commented 12 years ago

Awesome

grayghostvisuals commented 12 years ago

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

pekpon commented 12 years ago

thanks @MPV !!!!!

carstenevers commented 11 years ago

Thanks - worked also for me. :-)

mikepack commented 11 years ago

Perfect, thanks @MPV!

artxgj commented 11 years ago

Thank you!!!

slant commented 11 years ago

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!

johana-star commented 11 years ago

@MPV Thanks! Works like a charm!

raldred commented 11 years ago

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 commented 11 years ago

Thank you for clearing this up.

eeldwin commented 11 years ago

Thanks MPV, awesome solution

buk commented 11 years ago

Thanks MPV

hapticdata commented 11 years ago

thanks @MPV!

asabaylus commented 11 years ago

fantastic!

yishenggudou commented 11 years ago

nice

digitalformula commented 11 years ago

Another +1. Thanks @MPV!

ConlinJoe commented 11 years ago

Thanks @MVP. Worked perfectly...

julienbourdeau commented 11 years ago

Great! Thanks a lot!

nesk commented 11 years ago

Worked for me, thanks!

denislutz commented 11 years ago

Thx MPV!

mathiasbynens commented 11 years ago

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

jbudziak commented 11 years ago

Thanks ! :)

chamnap commented 10 years ago

Thanks :)

ghost commented 10 years ago

Works! Thank you so much.

njj commented 10 years ago

:+1:

pkoht commented 10 years ago

thanks @MVP!

zoubeiri commented 10 years ago

Thanks!

yaronyosef commented 10 years ago

thanks MPV!

luruke commented 10 years ago

Thanks!

wsvincent commented 10 years ago

Lifesaver. Thanks!

reco commented 10 years ago

same here thanks!!!

spotim-admin commented 10 years ago

thanks

todrobbins commented 10 years ago

Thanks @MPV! Champion of my hour!

Otoris commented 10 years ago

2 years later and this still saves me @MPV!

Preen commented 10 years ago

@MPV - SWEET THANKS :dancer:

bennyng commented 10 years ago

@MPV nice, it helped me out!

LeonFedotov commented 10 years ago

also just:

cd `brew --prefix`; git reset --hard
BitMangler commented 10 years ago

@MPV...BIG thanks !!!

ajubayer commented 10 years ago

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?

MikeMcQuaid commented 10 years ago

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