How to fix: brew update files overwritten by merge

Sometimes when you run:

brew update

You get an error:

brew update the following untracked working tree files would be overwritten by merge

According to the repo wiki for Homebrew this is caused by an old bug in update that has long since been fixed.

Basically you have changed (uncommitted) files in your Homebrew working directory that you need to deal with. You simply need to reset the working directory so your update command can pull the latest files. If you’re familiar with git – then this will all make sense, if not, just run these 3 commands and your Homebrew will be fixed!

cd /usr/local
git fetch origin
git reset --hard origin/master


  1. Richard Joseph says

    Thanks for this, got my Homebrew install working again after a year or two away from my Mac (I’d gone Ubuntu, recently).

    Just wanted to point out that I needed to add ‘sudo’ to your line 3 to get this to work (e.g. ‘sudo git reset..’) .

    Thanks again


Leave a Reply

Your email address will not be published. Required fields are marked *