Brew: /usr/local/Homebrew migration tracking issue

Created on 17 Sep 2016  ·  100Comments  ·  Source: Homebrew/brew

If you were directed to report your errors here by brew update please post a comment if your error is different to a previously mentioned comment and otherwise "Subscribe" to this issue rather than posting 👍 or "me too" etc.

Thanks and sorry for the inconvenience.

bug

Most helpful comment

I needed to run brew update --force to get it to run the migration again. Now all fine.

All 100 comments

I am getting

$ brew update
fatal: ambiguous argument 'refs/remotes/origin/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: Couldn't find remote ref refs/heads/master
Error: Fetching /usr/local/Library/Taps/flokru/homebrew-self failed!

Don't know if this is relevant for this issue. I was recently updating brew which went fine, afterwards I got the git error message above while running brew upgrade on packages. The latter failed as it told me the package was not properly linked (brew doctor noticed the same). After linking, the upgrade worked. Now brew update is stuck as noticed above.

@flokru It's not related because we haven't even started the migration (#963) yet.

Re linking problem:

$ brew unlink $(brew ls)
$ brew link $(brew ls)

As for the update problem, could you

$ brew untap flokru/self
$ brew tap flokru/self

and see if that helps?

Thanks, that helps. Actually my tap at https://github.com/flokru/homebrew-self is empty. I don't know when and why it got in there (nor what I was trying to accomplish while foolishly adding it in the past). Not tapping it after untapping helps. Sorry for the noise.

Edit: It's fixed with cd /usr/local; git fetch; git reset --hard origin/master set of commands, even though it didn't work the first time I tried it. _Shrug_

Hello, I'm not really a super literate brew user so I'm not sure how to address this but I think this is a similar error. It seems that brew link/brew unlink and brew doctor also produce the same error.

$ brew update 
Error: No such file or directory - (../../../Cellar/autoconf/2.69, /usr/local/var/homebrew/linked/autoconf)

@Cynlic Run brew update twice and that should fix it.

Posting this (new) error message here, for general awareness:

$ brew install ansible
==> Auto-updated Homebrew!
Updated Homebrew from 5654100 to f4a8d28.
Updated 1 tap (homebrew/core).
==> Updated Formulae
ponyc

==> Migrating HOMEBREW_REPOSITORY (please wait)...
share/man/man1/brew-cask.1: needs merge
share/man/man1/brew-cask.1: needs merge
share/man/man1/brew-cask.1: unmerged (483feec5ebfefa746c6f36d40a69965c56807986)
share/man/man1/brew-cask.1: unmerged (dd2bc133c7dccf4a7a1e7fc9960c61e3c60ae570)
fatal: git-write-tree: error building trees
Cannot save the current index state
Error: Failure while executing: git -c user.email=brew-update@localhost -c user.name=brew\ update stash save --include-untracked
Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Please comment with your (new) error in issue:
  https://github.com/Homebrew/brew/issues/987
/usr/local/Library/Homebrew/utils.rb:367:in `safe_system'
/usr/local/Library/Homebrew/cmd/update-report.rb:211:in `block in migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/extend/pathname.rb:328:in `block in cd'
/usr/local/Library/Homebrew/extend/pathname.rb:328:in `chdir'
/usr/local/Library/Homebrew/extend/pathname.rb:328:in `cd'
/usr/local/Library/Homebrew/cmd/update-report.rb:210:in `migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:103:in `update_report'
/usr/local/Library/Homebrew/brew.rb:99:in `<main>'
==> Installing dependencies for ansible: libyaml
==> Installing ansible dependency: libyaml
==> Downloading https://homebrew.bintray.com/bottles/libyaml-0.1.6_1.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libyaml-0.1.6_1.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/libyaml/0.1.6_1: 8 files, 312.9K
==> Installing ansible
==> Downloading https://homebrew.bintray.com/bottles/ansible-2.1.1.0.el_capitan.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring ansible-2.1.1.0.el_capitan.bottle.1.tar.gz
🍺  /usr/local/Cellar/ansible/2.1.1.0: 9,928 files, 99.3M

The list of installed Homebrew packages at the time of the error isn't large:

$ brew list
ansible     cmake       libyaml     openssl     sqlcipher   xz

Things still seem to be working. eg brew list works, as did both brew remove and brew doctor (without warnings) afterwards.

The error message itself though is kind of concerning. :wink:

Getting this problem also on the build of PR https://github.com/Homebrew/homebrew-core/pull/4945, sierra passed, elcapitan and yosemite failed with same problem:

[el_capitan] $ /bin/sh -xe /var/folders/03/jqjv4qms2b18_hwt2dcgsghc0000gp/T/hudson8974165171645172947.sh
+ env
+ grep JENKINS
+ grep -iv cookie
JENKINS_HOME=/Users/brew/Jenkins
JENKINS_URL=https://bot.brew.sh/
+ GIT_WORK_TREE=/usr/local
+ GIT_DIR=/usr/local/.git
+ git reset --hard origin/master
HEAD is now at 59b7f16 Merge pull request #989 from MikeMcQuaid/rubocop-final
+ brew update
Updated Homebrew from 59b7f16 to e204679.
No changes to formulae.
==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: No such file or directory - (../Homebrew/bin/brew, /usr/local/bin/brew)
Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Please comment with your (new) error in issue:
  https://github.com/Homebrew/brew/issues/987
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:349:in `symlink'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:349:in `block in ln_s'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1574:in `fu_each_src_dest0'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:347:in `ln_s'
/usr/local/Library/Homebrew/cmd/update-report.rb:260:in `migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:103:in `update_report'
/usr/local/Library/Homebrew/brew.rb:99:in `<main>'
Build step 'Execute shell' marked build as failure
Recording test results
ERROR: Step ‘Publish JUnit test result report’ failed: No test report files were found. Configuration error?
Archiving artifacts
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in  7 second
[WS-CLEANUP] Deleting project workspace...[WS-CLEANUP] done
Finished: FAILURE

@rodrigues You can ignore that, it's been addressed, thanks.

@justinclift You need to resolve the Git conflicts/merges in your repository.

@MikeMcQuaid You mean nuke my local branches?

@MikeMcQuaid I'm trying to figure out what the conflicts/merges are about.

  • There were several branches in git. Thankfully, they were mostly just old stuff, so nuked them.
  • There were two git stashes left over from previous fighting with Homebrew. Nuked those too.

It's still complaining with the same error message. Any idea how to figure out what the problems it's complaining about are?

@justinclift Actually, I may have a fix. Coming right up...

Cool. :smile:

@justinclift Try to brew pull https://github.com/Homebrew/brew/pull/1020 and then brew update and it should sort you out. If not: post again in that PR, thanks!

Thanks @MikeMcQuaid, that worked. :smile:

==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: unknown file type: /usr/local/Caskroom/suspicious-package/latest/.fseventsd/00000000001a4b41
Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Please comment with your new error in issue or +1 an existing error:
  https://github.com/Homebrew/brew/issues/987
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1375:in `copy'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:463:in `block in copy_entry'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1485:in `call'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1485:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1488:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1488:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1488:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1488:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:460:in `copy_entry'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:435:in `block in cp_r'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1558:in `block in fu_each_src_dest'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1574:in `fu_each_src_dest0'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1556:in `fu_each_src_dest'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:434:in `cp_r'
/usr/local/Library/Homebrew/cmd/update-report.rb:235:in `migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:103:in `update_report'
/usr/local/Library/Homebrew/brew.rb:99:in `<main>'
$ brew install awscli

==> Migrating HOMEBREW_REPOSITORY (please wait)...
==> Migrated HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Homebrew no longer needs to have ownership of /usr/local. If you wish you can
return /usr/local to its default ownership with:
  sudo chown root:wheel /usr/local
/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby: No such file or directory -- /usr/local/Library/Homebrew/brew.rb (LoadError)

I just got the following (error on last line) after being migrated while trying to upgrade a formula:

$ brew upgrade postgresql
==> Auto-updated Homebrew!
Updated Homebrew from 8e9a9b6 to 13f08a2.
Updated 3 taps (homebrew/core, homebrew/science, homebrew/versions).
==> Updated Formulae
git-town                        homebrew/versions/gcc6          languagetool                    mg3a                            pkg-config ✔                    proof-general                 

==> Migrating HOMEBREW_REPOSITORY (please wait)...
==> Migrated HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Homebrew no longer needs to have ownership of /usr/local. If you wish you can
return /usr/local to its default ownership with:
  sudo chown root:wheel /usr/local
/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby: No such file or directory -- /usr/local/Library/Homebrew/brew.rb (LoadError)

Is this just because the formula upgrade is trying to find brew.rb in the old location this one time, or some other harmless reason? Same command works fine now. brew doctor is fine and git status inside /usr/local/Homebrew says:

On branch master
nothing to commit, working tree clean

Thanks

Edit: Same as @viktorbenei it seems.

Is this just because the formula upgrade is trying to find brew.rb in the old location this one time.

Probably, rough edge I guess.

Do you have any problem afterwards?

EDIT: I missed the "Same command works fine now." part, sorry.

TL;DR; for my and @MatzFan 's issue: brew install X fails if install performs the update, but brew update && brew install X works, as there brew update handles the migration correctly, and then install can proceed

This is mainly an issue in CI environment btw

I believe this is an issue of install/upgrade calling udpate first (without HOMEBREW_NO_AUTO_UPDATE, that is).

correct @zmwangx

No issues @zmwangx . As per @viktorbenei's comment, seems any arg passed during brew install or brew upgrade is ignored if migration is triggered.

@MatzFan Yeah, just as you said it was trying to find brew.rb in the old location (brew install without HOMEBREW_NO_AUTO_UPDATE runs update logic first which is in brew's bash layer, it then relays to the ruby layer for install which fails to find the file). This should only happen once and you shouldn't need to worry about it. We'll probably come up with a solution or warning for future folks though, thanks for the report.

Working on a fix to the auto-update issue.

Ran out of disk space during migration. Now, everything _seems_ to be ok but no way to be sure?! Are there some files left behind and forgotten? Is something not migrated correctly and failing later?

==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: No space left on device - write
Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Please comment with your new error in issue or +1 an existing error:
https://github.com/Homebrew/brew/issues/987
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1382:in `copy_stream'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1382:in `block (2 levels) in copy_file'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1381:in `open'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1381:in `block in copy_file'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1380:in `open'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1380:in `copy_file'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1348:in `copy'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:463:in `block in copy_entry'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1485:in `call'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1485:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1488:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `wrap_traverse'
[previous 3 lines repeated 5 times]
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:460:in `copy_entry'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:435:in `block in cp_r'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1558:in `block in fu_each_src_dest'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1574:in `fu_each_src_dest0'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1556:in `fu_each_src_dest'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:434:in `cp_r'
/usr/local/Library/Homebrew/cmd/update-report.rb:235:in `migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:103:in `update_report'
/usr/local/Library/Homebrew/brew.rb:99:in `<main>'

@jjv Have hopefully improved the messaging. Everything should be fine once you free up the disk-space and rerun brew update.

@krsmes I've improved the error message but you'll need to resolve that yourself by deleting the relevant files causing the issues.
@viktorbenei @MatzFan your issues should be fixed by https://github.com/Homebrew/brew/pull/1026 (now merged)

Awesome, thank you @MikeMcQuaid !

@viktorbenei My pleasure, sorry for the pain. Shout if that doesn't resolve things for you or if you spot other issues, thanks.

Sure, I definitely will, thanks again @MikeMcQuaid :)

The migration seemed to have worked OK for me, but I did get this error at the end (running Sierra GM):

==> Migrated HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Homebrew no longer needs to have ownership of /usr/local. If you wish you can
return /usr/local to its default ownership with:
  sudo chown root:wheel /usr/local
/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby: No such file or directory -- /usr/local/Library/Homebrew/brew.rb (LoadError)

@timsutton Should be fixed by https://github.com/Homebrew/brew/pull/1026. If you can still reproduce that now: let me know.

Previously failed/interrupted migration prevents new migration. brew doctor reports "Your system is ready to brew." but no /usr/local/Homebrew exists after re-running brew update.

==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: /usr/local/Homebrew already exists.
Please remove it manually or uninstall and reinstall Homebrew into a new
location as the migration cannot be done automatically.

➜  mv /usr/local/Homebrew /usr/local/Homebrew_tmp

➜  brew update                                                                                               
Already up-to-date.

➜  ls -la /usr/local/Homebrew                                                                              
ls: /usr/local/Homebrew: No such file or directory

@MikeMcQuaid on MacOS systems where brew was not updated for a while the issue is still reproducable, a simple brew install awscli fails with:

+ brew install awscli
==> Auto-updated Homebrew!
Updated Homebrew from ddafaae to c45119d.
Updated 1 tap (homebrew/core).
==> New Formulae
mpage
==> Updated Formulae
aria2
autoconf-archive
cli53
convox
corectl
crystal-lang
digdag
emacs
erlang
fio
ford
git-flow-avh
git-town
haskell-stack
ios-deploy
languagetool
libstrophe
mg3a
ntl
pkg-config
ponyc
predictionio
prometheus
proof-general
sdcv
wxmac
x264
xorriso
yara
==> Deleted Formulae
pyqwt
rsense
sqsh
yap

==> Migrating HOMEBREW_REPOSITORY (please wait)...
==> Migrated HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Homebrew no longer needs to have ownership of /usr/local. If you wish you can
return /usr/local to its default ownership with:
  sudo chown root:wheel /usr/local
/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby: No such file or directory -- /usr/local/Library/Homebrew/brew.rb (LoadError)

@viktorbenei Can I see the brew config for one of those systems? Also, can you try and see why /usr/local/Library/Homebrew/brew.rb doesn't exist as it should?

@jjv brew update --force will force it to try again.

@MikeMcQuaid here's the output of brew config:

+ brew config
HOMEBREW_VERSION: 0.9.9
ORIGIN: https://github.com/Homebrew/brew
HEAD: ddafaaecfc08ac704eedbc19e669bc60b0a0a157
Last commit: 3 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 5c69a6da3d26392fba96485d0aed456debb2821b
Core tap last commit: 3 days ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: dual-core 64-bit nehalem
Homebrew Ruby: 2.0.0-p648
Clang: 7.3 build 703
Git: 2.8.2 => /usr/local/bin/git
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/local/bin/ruby => /usr/local/Cellar/ruby/2.2.4/bin/ruby
Java: 1.8.0_92
OS X: 10.11.6-x86_64
Xcode: 7.3.1
CLT: 7.3.1.0.1.1461711523
X11: 2.7.8 => /opt/X11

The strange thing is, brew config && brew install awscli also works, only brew install awscli does not O_O

@viktorbenei I think this is something specific to your environment because it doesn't seem to be widely reproducible? Any more information you have for me about these machines? Did you say it's CI?

@MikeMcQuaid CI - https://www.bitrise.io/ - AFAIK the only thing what might be "strange" is that the Ruby version of these stacks (Xcode 7.3 and older) is 2.2.4, installed from a tap ( https://github.com/bitrise-io/homebrew-pinned ), because at the time when these stacks were created CocoaPods (0.39) did not work with the latest (2.3) Ruby version, which was available in Homebrew

On brew update I get:

==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: unknown file type: /usr/local/Caskroom/keepassx/2.0-alpha6/KeePassX.app/Contents/Resources/keepassx/.svn
Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Please comment with your new error in issue or +1 an existing error:
  https://github.com/Homebrew/brew/issues/987
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1369:in `copy'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:463:in `block in copy_entry'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1479:in `call'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1479:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1482:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1482:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1482:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1482:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1482:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1482:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1482:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:460:in `copy_entry'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:435:in `block in cp_r'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1552:in `block in fu_each_src_dest'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1568:in `fu_each_src_dest0'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1550:in `fu_each_src_dest'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:434:in `cp_r'
/usr/local/Library/Homebrew/cmd/update-report.rb:235:in `migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:103:in `update_report'
/usr/local/Library/Homebrew/brew.rb:99:in `<main>'

@MikeMcQuaid CI - https://www.bitrise.io/ - AFAIK the only thing what might be "strange" is that the Ruby version of these stacks (Xcode 7.3 and older) is 2.2.4, installed from a tap ( https://github.com/bitrise-io/homebrew-pinned ), because at the time when these stacks were created CocoaPods (0.39) did not work with the latest (2.3) Ruby version, which was available in Homebrew

@realgeek You'll need to delete the relevant files and run brew update --force again.

@realgeek what's the output of

ls -le /usr/local/Caskroom/keepassx/2.0-alpha6/KeePassX.app/Contents/Resources/keepassx/.svn
file /usr/local/Caskroom/keepassx/2.0-alpha6/KeePassX.app/Contents/Resources/keepassx/.svn
stat /usr/local/Caskroom/keepassx/2.0-alpha6/KeePassX.app/Contents/Resources/keepassx/.svn
mdutil -t /usr/local/Caskroom/keepassx/2.0-alpha6/KeePassX.app/Contents/Resources/keepassx/.svn
mdls /usr/local/Caskroom/keepassx/2.0-alpha6/KeePassX.app/Contents/Resources/keepassx/.svn
xattr -l /usr/local/Caskroom/keepassx/2.0-alpha6/KeePassX.app/Contents/Resources/keepassx/.svn

@MikeMcQuaid @ilovezfs I'm not sure why, but some of the files and dirs of the KeepassX app were owned by root and some dirs did not have execute bits set. I suspect the app did something to its own installation after running (it was originally allowed to control the computer via Sysprefs/Security/Accessibility).

Once I chown'd, chmod'd that tree and also made /usr/local owned by me, I tried brew update --force but it complained about Homebrew already existing. I temporarily moved that dir out of the way, retried, and the migration was successful. Thanks for your help.

Also of note: One of my symlinks wasn't updated. brew doctor said that the /usr/local/bin/soffice link was broken. I manually pointed it to /usr/local/Homebrew/Caskroom/libreoffice/5.2.1/soffice.wrapper.sh.

@MikeMcQuaid, same problem as @viktorbenei here:

==> Migrating HOMEBREW_REPOSITORY (please wait)...
==> Migrated HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Homebrew no longer needs to have ownership of /usr/local. If you wish you can
return /usr/local to its default ownership with:
  sudo chown root:wheel /usr/local
/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby: No such file or directory -- /usr/local/Library/Homebrew/brew.rb (LoadError)

brew.rb is in /usr/local/Homebrew/Library/Homebrew, not in /usr/local/Library/Homebrew

brew config output:

HOMEBREW_VERSION: 0.9.9
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: 3ffb9a2f7cda6652f75cb0c59c6d079ab1039e94
Last commit: 86 minutes ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 5ae1f185d9f24d5cc82f9524df7288297a3a0c74
Core tap last commit: 56 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: quad-core 64-bit broadwell
Homebrew Ruby: 2.0.0-p648
Clang: 8.0 build 800
Git: 2.8.4 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Perl: /usr/bin/perl
Python: /Users/user/anaconda/bin/python => /Users/user/anaconda/bin/python2.7
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
Java: 1.8.0_102
macOS: 10.11.6-x86_64
Xcode: 8.0
CLT: 7.3.1.0.1.1461711523
X11: 2.7.9 => /opt/X11

Also of note: One of my symlinks wasn't updated. brew doctor said that the /usr/local/bin/soffice link was broken. I manually pointed it to /usr/local/Homebrew/Caskroom/libreoffice/5.2.1/soffice.wrapper.sh.

Should be fixed (or broken again 😭) by https://github.com/Homebrew/brew/pull/1025.

@juanfcocontreras @viktorbenei as a temporary workaround always run brew update first. Can you send me the output of whatever command you use but with --debug --verbose appended? Thanks!

Sure. I forgot to mention that while I got the same error as @viktorbenei (/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby: No such file or directory -- /usr/local/Library/Homebrew/brew.rb (LoadError)) I can install packages without issues or needing to run brew update first.

I attach brew install awscli --debug --verbose output.

output.txt

@juanfcocontreras Are you using a CI provider or any other way to repeatedly reproduce this? Thanks!

@juanfcocontreras And sorry that I wasn't clear: I need logs from a failing migration/install.

What is a CI provider? I'm using homebrew locally (if that is related to that question).

Sorry, but Homebrew seems to be working well, except for the /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby: No such file or directory -- /usr/local/Library/Homebrew/brew.rb (LoadError) error while updating.

Do you think it could cause side effects in the future?

@juanfcocontreras It won't cause issues in future, you're all good.

@viktorbenei Any chance I could get access to a CI machine that you can reproduce this on?

@MikeMcQuaid "unfortunately" not anymore - http://blog.bitrise.io/2016/09/19/quickfix-stack-update.html

But if you want it, we can manage to secure a VM for you with the state before the update

@viktorbenei Could you email me at [email protected]? Thanks!

Sure, will do it in a minute

$ brew update

Here's what I see the first time:

==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
The error was:
  Operation not permitted - /usr/local/Library/Taps/caskroom/homebrew-cask/Casks/bittorrent.rb
Please try to resolve this error yourself and then run `brew update` again to
complete the migration. If you need help please +1 an existing error or comment
with your new error in issue:
  https://github.com/Homebrew/brew/issues/987
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1380:in `initialize'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1380:in `open'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1380:in `copy_file'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1348:in `copy'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:463:in `block in copy_entry'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1485:in `call'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1485:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1488:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1488:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1488:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1488:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:460:in `copy_entry'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:435:in `block in cp_r'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1558:in `block in fu_each_src_dest'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1574:in `fu_each_src_dest0'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1556:in `fu_each_src_dest'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:434:in `cp_r'
/usr/local/Library/Homebrew/cmd/update-report.rb:231:in `migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:103:in `update_report'
/usr/local/Library/Homebrew/brew.rb:99:in `<main>'

Second time:

Already up-to-date.

Then

$ brew upgrade node

The output includes this error:

==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: /usr/local/Homebrew already exists.
Please remove it manually or uninstall and reinstall Homebrew into a new
location as the migration cannot be done automatically.

It seems to work anyway.

@matthew-simoneau You need to sudo chown -R $USER /usr/local; brew update --force

Thanks for your reply, @MikeMcQuaid.

That chown -R is unsettling, but the Internet confirms that's standard practice.

I gave it a shot, but it didn't work:

$ sudo chown -R $USER /usr/local; brew update --force
Already up-to-date.
==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: /usr/local/Homebrew already exists.
Please remove it manually or uninstall and reinstall Homebrew into a new
location as the migration cannot be done automatically.

I guess I could try following the instructions in that error message and delete /usr/local/Homebrew?

@matthew-simoneau Yes, remove it manually and try again. FWIW permission changes like that should not be required as broadly again in future.

$ rm -rf /usr/local/Homebrew
$ ls /usr/local/Homebrew
ls: /usr/local/Homebrew: No such file or directory
$ sudo chown -R $USER /usr/local
$ brew update --force
Updated 1 tap (caskroom/cask).
No changes to formulae.
==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
The error was:
  Operation not permitted - /usr/local/Library/Taps/caskroom/homebrew-cask/Casks/bittorrent.rb
Please try to resolve this error yourself and then run `brew update` again to
complete the migration. If you need help please +1 an existing error or comment
with your new error in issue:
  https://github.com/Homebrew/brew/issues/987
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1380:in `initialize'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1380:in `open'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1380:in `copy_file'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1348:in `copy'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:463:in `block in copy_entry'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1485:in `call'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1485:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1488:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1488:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1488:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1488:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:460:in `copy_entry'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:435:in `block in cp_r'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1558:in `block in fu_each_src_dest'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1574:in `fu_each_src_dest0'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1556:in `fu_each_src_dest'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:434:in `cp_r'
/usr/local/Library/Homebrew/cmd/update-report.rb:231:in `migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:103:in `update_report'
/usr/local/Library/Homebrew/brew.rb:99:in `<main>'

@matthew-simoneau Try to brew untap caskroom/cask and try again.

brew upgrades are always resulting in issues linking, here is a representative output:

~ $ brew upgrade
==> Auto-updated Homebrew!
Updated Homebrew from e22610a to 7a63a75.
Updated 1 tap (homebrew/core).
==> Updated Formulae
dropbox-uploader          gron                      jenkins                   pyenv ✔                   tarantool
gnu-smalltalk             guile                     node-build                redpen                    terraform ✔
graphviz                  httping ✔                 platformio                svtplay-dl                vim ✔

==> Upgrading 4 outdated packages, with result:
httping 2.5, pyenv 1.0.2, terraform 0.7.4, vim 8.0.0005
==> Upgrading httping
==> Downloading https://homebrew.bintray.com/bottles/httping-2.5.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring httping-2.5.el_capitan.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/httping
Target /usr/local/bin/httping
is a symlink belonging to httping. You can unlink it:
  brew unlink httping

To force the link and overwrite all conflicting files:
  brew link --overwrite httping

To list all files that would be deleted:
  brew link --overwrite --dry-run httping

Possible conflicting files are:
/usr/local/bin/httping -> /usr/local/Cellar/httping/2.4_1/bin/httping
/usr/local/share/doc/httping/license.OpenSSL
/usr/local/share/doc/httping/license.txt
/usr/local/share/doc/httping/readme.txt
/usr/local/share/doc/httping/license.OpenSSL
/usr/local/share/doc/httping/license.txt
/usr/local/share/doc/httping/readme.txt
/usr/local/share/man/man1/httping.1 -> /usr/local/Cellar/httping/2.4_1/share/man/man1/httping.1
/usr/local/share/man/nl/man1/httping-nl.1 -> /usr/local/Cellar/httping/2.4_1/share/man/nl/man1/httping-nl.1
==> Summary
🍺  /usr/local/Cellar/httping/2.5: 11 files, 157.9K
==> Upgrading pyenv
[...]

(Truncated because it's basically the same thing for every other package)

@alex I think was another bug but the workaround is brew unlink $(brew list); brew link $(brew list).

@MikeMcQuaid I currently have packages installed which are not linked, which this would link. Is there a way to get a list of all install packages _which are linked_?

@alex Yep, the contents of /usr/local/var/homebrew/linked.

Ok, thanks. Will report back if this causes issues on other packages

I'm getting

$ brew update
Updated Homebrew from 1c5fa19 to 71cffef.
Updated 3 taps (caskroom/cask, d12frosted/emacs-plus, homebrew/core).
==> New Formulae
eventql                                                                 mpage
==> Updated Formulae
amazon-ecs-cli                      digdag                              hyper                               predictionio
ammonite-repl                       dropbox-uploader                    idris                               prometheus
antigen                             elixir                              ios-deploy                          proof-general
apr-util                            emacs                               jenkins                             protobuf-swift
argus-clients                       erlang                              json-fortran                        pyenv
aria2                               etcd                                kitchen-sync                        redpen
augeas                              fio                                 kpcli                               sdcc
autoconf-archive                    ford                                languagetool                        sdcv
aws-sdk-cpp                         fwup                                libphonenumber                      shpotify
bash                                fzf                                 libstrophe                          sops
cake                                git-flow-avh                        logentries                          svtplay-dl
carina                              git-town                            mas                                 takt
ceylon                              gnu-smalltalk                       mg3a                                tarantool
cfr-decompiler                      gradle                              mono                                terraform
cli53                               grails                              node ✔                              valgrind
convox                              graphviz                            node-build                          vim
corectl                             gron                                ntl                                 wxmac
crystal-lang                        guile                               nvm                                 x264
d12frosted/emacs-plus/emacs-plus ✔  haskell-stack ✔                     pkg-config ✔                        xorriso
darcs                               highlighting-kate                   platformio                          yara
diff-so-fancy                       httping                             ponyc                               youtube-dl
==> Deleted Formulae
lftp                pgtap               pyqwt               rbenv-readline      rsense              sqsh                yap
==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
The error was:
  File exists - (../Homebrew/bin/brew, /usr/local/bin/brew)
Please try to resolve this error yourself and then run `brew update` again to
complete the migration. If you need help please +1 an existing error or comment
with your new error in issue:
  https://github.com/Homebrew/brew/issues/987
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:349:in `symlink'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:349:in `block in ln_s'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1574:in `fu_each_src_dest0'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:347:in `ln_s'
/usr/local/Library/Homebrew/cmd/update-report.rb:265:in `migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:105:in `update_report'
/usr/local/Library/Homebrew/brew.rb:99:in `<main>'

@kojustin Remove /usr/local/bin/brew and manually create the symlink to /usr/local/Homebrew/bin/brew.

Closing this out because it's quieted down but please keep reporting stuff in here.

this is my error:

brew update --force
Already up-to-date.
==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: /usr/local/Homebrew already exists.
Please remove it manually or uninstall and reinstall Homebrew into a new
location as the migration cannot be done automatically.

How can I repair it? thanks

Error: /usr/local/Homebrew already exists.
Please remove it manually or uninstall and reinstall Homebrew into a new
location as the migration cannot be done automatically.

Remove that directory and then run brew update --force again (as the instructions suggest)

@MikeMcQuaid but and my packages? i lose?

@unluisco Your packages are in /usr/local/Cellar, not /usr/local/Homebrew.

This is my error:

==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
The error was:
  Permission denied - /usr/local/lib/pkgconfig
Please try to resolve this error yourself and then run `brew update` again to
complete the migration. If you need help please +1 an existing error or comment
with your new error in issue:
  https://github.com/Homebrew/brew/issues/987
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:245:in `mkdir'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:245:in `fu_mkdir'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:219:in `block (2 levels) in mkdir_p'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:217:in `reverse_each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:217:in `block in mkdir_p'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:203:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:203:in `mkdir_p'
/usr/local/Library/Homebrew/cmd/update-report.rb:259:in `block in migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:258:in `each'
/usr/local/Library/Homebrew/cmd/update-report.rb:258:in `migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:105:in `update_report'
/usr/local/Library/Homebrew/brew.rb:99:in `<main>'

Later on when I type brew update it shows -bash: /usr/local/bin/brew: No such file or directory

Please help!

@antruongnguyen sudo chown -R $USER /usr/local; ln -s /usr/local/Homebrew/bin/brew /usr/local/bin/brew; brew update --force should sort you out.

Another error, and fix:

$ brew update
/usr/local/Homebrew/Library/Homebrew/utils/lock.sh: line 19: /usr/local/var/homebrew/locks/update: Permission denied
-e:1:in `initialize': Bad file descriptor (Errno::EBADF)
    from -e:1:in `new'
    from -e:1:in `<main>'
Error: Another active Homebrew process is already in progress.
Please wait for it to finish or terminate it to continue.

Fix:

$ sudo chown -R $(whoami) /usr/local/var/homebrew/

And yet another:

Error: Permission denied - /usr/local/Caskroom/qlstephenMost likely, this means you have an outdated version of Homebrew-Cask. Please run:

    brew uninstall --force brew-cask; brew untap phinze/cask; brew untap caskroom/cask; brew update; brew cleanup; brew cask cleanup

Fix:

sudo chown -R $(whoami) /usr/local/Caskroom

@hmijail If you know how to fix these issues you don't need to post them here.

Sorry, was looking for the fixes here and then I realized the easy fix seemed to work OK. So I wrote them in case it helped someone else, or could get documented.

When running brew update - it did it's usual thing and then:

==> Migrating HOMEBREW_REPOSITORY (please wait)...
fatal: Unable to create '/usr/local/Homebrew/.git/index.lock': File exists.

Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.
Error: Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
The error was:
  Failure while executing: git checkout --force .
Please try to resolve this error yourself and then run `brew update` again to
complete the migration. If you need help please +1 an existing error or comment
with your new error in issue:
  https://github.com/Homebrew/brew/issues/987
/usr/local/Library/Homebrew/utils.rb:360:in `safe_system'
/usr/local/Library/Homebrew/cmd/update-report.rb:225:in `block in migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/extend/pathname.rb:328:in `block in cd'
/usr/local/Library/Homebrew/extend/pathname.rb:328:in `chdir'
/usr/local/Library/Homebrew/extend/pathname.rb:328:in `cd'
/usr/local/Library/Homebrew/cmd/update-report.rb:224:in `migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:105:in `update_report'
/usr/local/Library/Homebrew/brew.rb:99:in `<main>'

I removed the lock file and ran brew update and then it said:

sed: .git/GITHUB_HEADERS: No such file or directory
Already up-to-date.

Now when I run again it just says Already up-to-date - and I'm left with a /usr/local/Homebrew containing nothing but a .git folder. Not sure how I migrate this manually as I really like the idea of tidying up /usr/local!

I needed to run brew update --force to get it to run the migration again. Now all fine.

➜  ~ brew update --force
Updated 1 tap (homebrew/core).
No changes to formulae.
==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: /usr/local/Homebrew already exists.
Please remove it manually or uninstall and reinstall Homebrew into a new
location as the migration cannot be done automatically.
➜  ~ rm -rf /usr/local/Homebrew
➜  ~ ls /usr/local/Homebrew
ls: /usr/local/Homebrew: No such file or directory
➜  ~ sudo chown -R $USER /usr/local
Password:
➜  ~ brew update --force
Updated 1 tap (homebrew/core).
No changes to formulae.
==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
The error was:
  Permission denied - /usr/local/Library/Taps/homebrew/homebrew-versions/.git/objects/83/38d89c06dad15c3c008541527b2e289e7ced66.incompleteMigration
Please try to resolve this error yourself and then run `brew update` again to
complete the migration. If you need help please +1 an existing error or comment
with your new error in issue:
  https://github.com/Homebrew/brew/issues/987
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1374:in `initialize'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1374:in `open'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1374:in `copy_file'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1342:in `copy'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:463:in `block in copy_entry'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1479:in `call'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1479:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1482:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1482:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1482:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1482:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1482:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1482:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:460:in `copy_entry'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:435:in `block in cp_r'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1552:in `block in fu_each_src_dest'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1568:in `fu_each_src_dest0'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1550:in `fu_each_src_dest'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:434:in `cp_r'
/usr/local/Library/Homebrew/cmd/update-report.rb:234:in `migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:105:in `update_report'
/usr/local/Library/Homebrew/brew.rb:99:in `<main>'

@malopezcruz brew untap homebrew/versions; brew tap homebrew/versions; brew update --force; brew update --force

samair11:~ sam$ brew update
Updated 4 taps (caskroom/cask, caskroom/versions, homebrew/core, homebrew/services).
==> New Formulae
amqp-cpp
==> Updated Formulae
castxml glide terminal-notifier
==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: /usr/local/Homebrew already exists.
Please remove it manually or uninstall and reinstall Homebrew into a new
location as the migration cannot be done automatically.
samair11:~ sam$

Please remove it manually or uninstall and reinstall Homebrew into a new
location as the migration cannot be done automatically.

@spullara Do that or ask a more specific question if you're unsure, thanks.

I'm an infrequent brew user. For whatever reason today I ran a brew doctor which told me to do a brew update. I did so, with this result:

==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
The error was:
  File exists - (../Homebrew/bin/brew, /usr/local/bin/brew)
Please try to resolve this error yourself and then run `brew update` again to
complete the migration. If you need help please +1 an existing error or comment
with your new error in issue:
  https://github.com/Homebrew/brew/issues/987
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:349:in `symlink'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:349:in `block in ln_s'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1574:in `fu_each_src_dest0'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:347:in `ln_s'
/usr/local/Library/Homebrew/cmd/update-report.rb:266:in `migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:107:in `update_report'
/usr/local/Library/Homebrew/brew.rb:94:in `<main>'

Now any brew command I try yields this message:

$ brew
/usr/local/bin/brew: line 47: /usr/local/Library/Homebrew/brew.sh: No such file or directory

I decided to try re-installing, but that didn't help:

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew

Press RETURN to continue or any other key to abort
==> Downloading and installing Homebrew...
From https://github.com/Homebrew/brew
 x [deleted]         (none)     -> origin/master
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
fatal: ambiguous argument 'origin/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Failed during: git reset --hard origin/master

Any ideas on how to proceed would be helpful. Thanks.

@machale Run https://github.com/homebrew/install#uninstall-homebrew and try to install again. Sorry for the inconvenience.

Installing homebrew to a new machine with /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

==> Downloading and installing Homebrew...
remote: Counting objects: 3397, done.
remote: Compressing objects: 100% (2406/2406), done.
remote: Total 3397 (delta 1557), reused 2171 (delta 855), pack-reused 0
Receiving objects: 100% (3397/3397), 2.17 MiB | 618.00 KiB/s, done.
Resolving deltas: 100% (1557/1557), done.
From https://github.com/Homebrew/brew
 * [new branch]      master     -> origin/master
 * [new tag]         0.1        -> 0.1
 * [new tag]         0.2        -> 0.2
 * [new tag]         0.3        -> 0.3
 * [new tag]         0.4        -> 0.4
 * [new tag]         0.5        -> 0.5
 * [new tag]         0.6        -> 0.6
 * [new tag]         0.7        -> 0.7
 * [new tag]         0.7.1      -> 0.7.1
 * [new tag]         0.8        -> 0.8
 * [new tag]         0.8.1      -> 0.8.1
 * [new tag]         0.9        -> 0.9
 * [new tag]         0.9.1      -> 0.9.1
 * [new tag]         0.9.2      -> 0.9.2
 * [new tag]         0.9.3      -> 0.9.3
 * [new tag]         0.9.4      -> 0.9.4
 * [new tag]         0.9.5      -> 0.9.5
 * [new tag]         0.9.8      -> 0.9.8
 * [new tag]         0.9.9      -> 0.9.9
 * [new tag]         1.0.0      -> 1.0.0
 * [new tag]         1.0.1      -> 1.0.1
 * [new tag]         1.0.2      -> 1.0.2
 * [new tag]         1.0.3      -> 1.0.3
 * [new tag]         1.0.4      -> 1.0.4
 * [new tag]         1.0.5      -> 1.0.5
 * [new tag]         1.0.6      -> 1.0.6
 * [new tag]         1.0.7      -> 1.0.7
 x [deleted]         (none)     -> origin/master
fatal: ambiguous argument 'origin/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Failed during: git reset --hard origin/master

and tried to uninstall and install it again as @MikeMcQuaid said, but got no success, any idea?

@yeahdongcn Apologies, this was a regression that's now fixed in https://github.com/Homebrew/install/pull/74. Please try again.

@MikeMcQuaid Thanks, uninstalling cleaned things up. The uninstall process deleted everything under /usr/local/Cellar/ but luckily I saved a list of what I had in there before uninstalling, so I know what to go and reinstall. After a fresh install of brew 1.0.7, I was able to do a quick brew install ascii and it worked fine. brew doctor seems happy.

The uninstall process does not appear to have touched the one Cask I had and brew cask doctor also seems happy.

Thank you so much for your contribution to this amazing facility!

Glad to be of help.

After I run brew update, I get an error
==> Migrating HOMEBREW_REPOSITORY (please wait)... Error: Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew! The error was: Permission denied - /usr/local/lib/pkgconfig Please try to resolve this error yourself and then runbrew updateagain to complete the migration. If you need help please +1 an existing error or comment with your new error in issue: https://github.com/Homebrew/brew/issues/987

Then I run brew doctor, I get
-bash: /usr/local/bin/brew: No such file or directory

It seems that after the brew update fails, the system cannot locate homegrew

@ofWay I'd recommend running the Homebrew installer again.

I'm planning on following the advice above and just re-installing. But thought this info may be helpful.
I had an update fail, apparently usr/local/lib was a file instead of dir. After I resolved that I ran brew update again, and got:
-bash: /usr/local/bin/brew: No such file or directory

FWIW this is the output of the original update attempt.

==> Migrating Homebrew to v0.9.9
remote: Counting objects: 932, done.
remote: Compressing objects: 100% (828/828), done.
remote: Total 932 (delta 234), reused 410 (delta 82), pack-reused 0
Receiving objects: 100% (932/932), 849.12 KiB | 729.00 KiB/s, done.
Resolving deltas: 100% (234/234), completed with 153 local objects.
From https://github.com/Homebrew/brew
 + 5a9e19f...8019afb master     -> origin/master  (forced update)
HEAD is now at 8019afb Merge pull request #1346 from MikeMcQuaid/more-rubocop-tweaks
==> Homebrew has enabled anonymous aggregate user behaviour analytics
Read the analytics documentation (and how to opt-out) here:
  https://git.io/brew-analytics
==> Tapping homebrew/core
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-core'...
remote: Counting objects: 3741, done.
remote: Compressing objects: 100% (3631/3631), done.
remote: Total 3741 (delta 12), reused 299 (delta 1), pack-reused 0
Receiving objects: 100% (3741/3741), 2.99 MiB | 1.49 MiB/s, done.
Resolving deltas: 100% (12/12), done.
Checking connectivity... done.
Tapped 3620 formulae (3,768 files, 9.3M)
Already up-to-date.
==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
The error was:
  File exists - /usr/local/lib
Please try to resolve this error yourself and then run `brew update` again to
complete the migration. If you need help please +1 an existing error or comment
with your new error in issue:
  https://github.com/Homebrew/brew/issues/987
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:245:in `mkdir'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:245:in `fu_mkdir'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:219:in `block (2 levels) in mkdir_p'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:217:in `reverse_each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:217:in `block in mkdir_p'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:203:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:203:in `mkdir_p'
/usr/local/Library/Homebrew/cmd/update-report.rb:260:in `block in migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:259:in `each'
/usr/local/Library/Homebrew/cmd/update-report.rb:259:in `migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:107:in `update_report'
/usr/local/Library/Homebrew/brew.rb:94:in `<main>' 

Hey Mike - appreciate any direction you can provide.

I am running sierra and uninstalled an old version of home brew beccause I was having some probs. Try to re-install it and get the following:

Error: Another active Homebrew process is already in progress.
Please wait for it to finish or terminate it to continue.
Failed during: /usr/local/bin/brew update --force

I saw a similar error in another post but wasnt able to grok how to make it work.

Many thanks

@nuhuxi are there files in /usr/local/var/homebrew/locks? If so, removing them will make that message go away. You may want to make sure it's not telling the truth by rebooting first or checking ps aux | grep brew for any brew process(es) other than the grep itself and killing them.

@ilovezfs Thanks for the post. grep'd brew and saw nothing. Also no files in /usr/local/var/homebrew/locks. Tried to install again - no go. Here is the entire message:

==> Downloading and installing Homebrew...
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
HEAD is now at 79e8cdd Merge pull request #1253 from jawshooah/perf/relocate-text-files
/usr/local/Homebrew/Library/Homebrew/utils/lock.sh: line 19: /usr/local/var/homebrew/locks/update: Permission denied
-e:1:in initialize': Bad file descriptor (Errno::EBADF) from -e:1:innew'
from -e:1:in `

'
Error: Another active Homebrew process is already in progress.
Please wait for it to finish or terminate it to continue.
Failed during: /usr/local/bin/brew update --force

@ilovezfs It installed. It may have been absolute brute force but it worked. I went into /usr/local/var and rm's homebrew. Installed no problem.

Thanks for your help - truly appreciated.

Hi,

I didn't read through the full thread, but a simple search did not find anything relating to the error I encountered:

Removing: /Library/Caches/Homebrew/xz-5.2.2.el_capitan.bottle.tar.gz... (450.2K)
==> Migrating /Library/Caches/Homebrew to /Users/amoneger/Library/Caches/Homebrew...
==> Deleting /Library/Caches/Homebrew...
==> Migrating HOMEBREW_REPOSITORY (please wait)...
error: 'share/doc/homebrew/Acceptable-Formulae.md' is beyond a symbolic link
fatal: Unable to process path share/doc/homebrew/Acceptable-Formulae.md
Cannot save the current worktree state
Error: Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
The error was:
  Failure while executing: git -c user.email=brew-update@localhost -c user.name=brew\ update stash save --include-untracked
Please try to resolve this error yourself and then run `brew update` again to
complete the migration. If you need help please +1 an existing error or comment
with your new error in issue:
  https://github.com/Homebrew/brew/issues/987

Basically homebrew was a symlink to ../../docs:

amoneger@silvertip local/Homebrew (master !*%) » ls -l ../share/doc  | grep -i homebrew
lrwxr-x---  1 amoneger  admin   10 Jan 31 20:24 homebrew -> ../../docs

I just moved all stuff under ../../docs under a temp dir, deleted the symlink and created a directory instead:

amoneger@silvertip local/Homebrew (master !*%) » mkdir /tmp/brew_docs
amoneger@silvertip local/Homebrew (master !*%) » mv ../share/doc/homebrew/* /tmp/brew_docs
amoneger@silvertip local/Homebrew (master !*%) » rm -rf ../share/doc/homebrew/
amoneger@silvertip local/Homebrew (master !*%) » mkdir ../share/doc/homebrew/
amoneger@silvertip local/Homebrew (master !*%) » mv /tmp/abcd/brew_docs ../share/doc/homebrew/
amoneger@silvertip local/Homebrew (master !*%) » git -c user.email=brew-update@localhost -c user.name=brew\ update stash save --include-untracked
Saved working directory and index state WIP on master: 5a9e19f Fix documentation links (#50695)
HEAD is now at 5a9e19f Fix documentation links (#50695)

Hope it helps someone.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hktalent picture hktalent  ·  4Comments

fooness picture fooness  ·  4Comments

JustinTArthur picture JustinTArthur  ·  3Comments

JaKXz picture JaKXz  ·  3Comments

DomT4 picture DomT4  ·  3Comments