Tuesday, July 08, 2014

Homebrew and the Untracked Working Tree Files

On the Mac, you have package managers that are designed to allow you to install software via the command line.  Two of the majors are MacPorts and Homebrew.  This is specific to Homebrew as that is the one that I chose to use for my system.

If you are like me, you install the software you need and then don't touch Homebrew for a while.  During the lapse in use, the system tends to get stale and you will find that before you search for software or are able to install anything, that you must  first update it.

The update is usually simple and run as follows:
sudo brew update
Unfortunately, its not a perfect system, and will let you know this by pretty much bitching and complaining and exiting, refusing to update.  The output of such a hissy fit looks similar to this:

> sudo brew update --force
error: The following untracked working tree files would be overwritten by checkout:
Library/Aliases/fishfish
Library/Aliases/fluidsynth
Library/Aliases/gearmand
Library/Aliases/git-tig
Library/Aliases/gnu-scientific-library
Library/Aliases/google-go
Library/Aliases/gperftools
Library/Aliases/gpg
Library/Aliases/gpg2
Library/Contributions/brew_bash_completion.sh
Library/Contributions/brew_fish_completion.fish
Library/Contributions/brew_zsh_completion.zsh
Library/Contributions/cmd/brew-aspell-dictionaries.rb
Library/Contributions/cmd/brew-beer.rb
Library/Contributions/cmd/brew-bundle.rb
Library/Contributions/cmd/brew-cleanup-installed
Library/Contributions/cmd/brew-dirty.rb
Library/Contributions/cmd/brew-gist-logs.rb
Library/Contributions/cmd/brew-graph
Library/Contributions/cmd/brew-grep
Library/Contributions/cmd/brew-leaves.rb
Library/Contributions/cmd/brew-ls-taps.rb
Library/Contributions/cmd/brew-man
Library/Contributions/cmd/brew-mirror-check.rb
Library/Contributions/cmd/brew-profile.rb
Library/Contributions/cmd/brew-pull.rb
Library/Contributions/cmd/brew-readall.rb
Library/Contributions/cmd/brew-server
Library/Contributions/cmd/brew-services.rb
Library/Contributions/cmd/brew-switch.rb
Library/Contributions/cmd/brew-tap-readme.rb
Library/Contributions/cmd/brew-test-bot.rb
Library/Contributions/cmd/brew-tests.rb
Library/Contributions/cmd/brew-unpack.rb
Library/Contributions/cmd/brew-which.rb
Library/Contributions/cmd/git
Library/Contributions/cmd/public/bootstrap.min.css
Library/Contributions/cmd/public/glyphicons-halflings-white.png
Library/Contributions/cmd/public/glyphicons-halflings.png
Library/Contributions/cmd/svn
Library/Contributions/example-formula.rb
Library/Cont

No matter what you do with the brew command (at least from what I have found), you won't be able to update.  What is nice though, is that brew uses git to do its checkouts and updates.  And, for your knowledge going forward, brew uses /usr/local as its base directory.  So, the easiest way that I found to correct this issue and update brew is to completely bypass the command and go straight to git.  

The following set of commands should work to get your brew back up and working(note, I am sudo running these commands):
# cd /usr/local
# git fetch origin
# git reset --hard origin/master
After doing the above, you should find that running brew update has the following results:

# brew update
Already up-to-date. 
Why?  Because you just circumvented the brew command and updated it manually.  You can now run 'brew search ' or whatever other brew command you were going to run.  Have fun!
 

This work is licensed under a Creative Commons Attribution 3.0 License.
{"cc_re__cc_re__cc_by_3_0": ["tle='Edit'>\n<img alt='' height='18' src='https://resources.blogblog.com/img/icon18_wrench_allbkg.png' width='18'/>\n</a>\n</span>\n</span>\n<div class='clear'></div>\n</div>\n</div></div>\n</div>\n<!-- spacer for skins that want sidebar and main to be the same height-->\n<div class='clear'>&#160;</div>\n</div>\n<!-- end content-wrapper -->\n<div id='footer-wrapper'>\n<div class='footer no-items section' id='footer'></div>\n</div>\n</div></div>\n<!-- end outer-wrapper -->\n<!-- Begin Creative Commons License -->\n<a href='http://creativecommons.org/licenses/by/3.0/' rel='license'>\n<img alt='Creative Commons License' src='http://i.creativecommons.org/l/by/3.0/88x31.png' style='border-width:0'/>\n</a>\n<br/>This work is licensed under a \n<a href='http://creativecommons.org/licenses/by/3.0/' rel='license'>Creative Commons Attribution 3.0 License</a>.\n<!-- End Creative Commons License -->\n<script src='https://apis.google.com/js/plusone.js' type='text/javascript'></script>\n\n<script type=\"text/javascript\" src=\"https://www.blogger.com/static/v1/widgets/3375435565-widgets.js\"></sc", "bar and main to be the same height-->\n<div class='clear'>&#160;</div>\n</div>\n<!-- end content-wrapper -->\n<div id='footer-wrapper'>\n<div class='footer no-items section' id='footer'></div>\n</div>\n</div></div>\n<!-- end outer-wrapper -->\n<!-- Begin Creative Commons License -->\n<a href='http://creativecommons.org/licenses/by/3.0/' rel='license'>\n<img alt='Creative Commons License' src='http://i.creativecommons.org/l/by/3.0/88x31.png' style='border-width:0'/>\n</a>\n<br/>This work is licensed under a \n<a href='http://creativecommons.org/licenses/by/3.0/' rel='license'>Creative Commons Attribution 3.0 License</a>.\n<!-- End Creative Commons License -->\n<script src='https://apis.google.com/js/plusone.js' type='text/javascript'></script>\n\n<script type=\"text/javascript\" src=\"https://www.blogger.com/static/v1/widgets/3375435565-widgets.js\"></script>\n<script type='text/javascript'>\nwindow['__wavt'] = 'AOuZoY6y4lNZ9kgvDY9wAhrd1EF7iRBeVA:1597003895087';_WidgetManager._Init('//www.blogger.com/rearrange?blogID\\x3d23664930','//www.parsedcontent.com/2014/07/homebrew-and-u"]}