Homebrew / brew

๐Ÿบ The missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
41.58k stars 9.78k forks source link

/usr/local/Homebrew migration tracking issue #987

Closed MikeMcQuaid closed 8 years ago

MikeMcQuaid commented 8 years ago

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.

MikeMcQuaid commented 8 years ago

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

juanfcocontreras commented 8 years ago

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?

MikeMcQuaid commented 8 years ago

@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?

viktorbenei commented 8 years ago

@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

MikeMcQuaid commented 8 years ago

@viktorbenei Could you email me at mike@mikemcquaid.com? Thanks!

viktorbenei commented 8 years ago

Sure, will do it in a minute

matthew-simoneau commented 8 years ago
$ 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.

MikeMcQuaid commented 8 years ago

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

matthew-simoneau commented 8 years ago

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?

MikeMcQuaid commented 8 years ago

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

matthew-simoneau commented 8 years ago
$ 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>'
MikeMcQuaid commented 8 years ago

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

alex commented 8 years ago

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)

MikeMcQuaid commented 8 years ago

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

alex commented 8 years ago

@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?

MikeMcQuaid commented 8 years ago

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

alex commented 8 years ago

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

kojustin commented 8 years ago

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>'
MikeMcQuaid commented 8 years ago

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

MikeMcQuaid commented 8 years ago

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

luiscobot commented 8 years ago

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

MikeMcQuaid commented 8 years ago

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)

luiscobot commented 8 years ago

@MikeMcQuaid but and my packages? i lose?

jawshooah commented 8 years ago

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

antruongnguyen commented 8 years ago

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!

MikeMcQuaid commented 8 years ago

@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.

hmijail commented 8 years ago

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/
hmijail commented 8 years ago

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
MikeMcQuaid commented 8 years ago

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

hmijail commented 8 years ago

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.

driskell commented 8 years ago

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!

driskell commented 8 years ago

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

malopezcruz commented 8 years ago
โžœ  ~ 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>'
MikeMcQuaid commented 8 years ago

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

spullara commented 8 years ago

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$

MikeMcQuaid commented 8 years ago

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.

machale commented 8 years ago

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.

MikeMcQuaid commented 8 years ago

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

yeahdongcn commented 8 years ago

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?

MikeMcQuaid commented 8 years ago

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

machale commented 8 years ago

@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!

MikeMcQuaid commented 8 years ago

Glad to be of help.

ofWay commented 8 years ago

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

MikeMcQuaid commented 8 years ago

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

Zpunky commented 8 years ago

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>' 
nuhuxi commented 8 years ago

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

ilovezfs commented 8 years ago

@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.

nuhuxi commented 8 years ago

@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

nuhuxi commented 8 years ago

@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.

alexmgr commented 7 years ago

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.