Permissions 计算机还原后的自制安装问题

Permissions 计算机还原后的自制安装问题,permissions,installation,homebrew,Permissions,Installation,Homebrew,我刚买了一台新电脑,在用time machine备份恢复电脑之前安装了homebrew。恢复时,我更改了主用户文件名。我想这是造成我的问题的原因 Press RETURN to continue or any other key to abort ==> Downloading and installing Homebrew... remote: Counting objects: 230481, done. remote: Compressing objects: 100% (60411

我刚买了一台新电脑,在用time machine备份恢复电脑之前安装了homebrew。恢复时,我更改了主用户文件名。我想这是造成我的问题的原因

Press RETURN to continue or any other key to abort
==> Downloading and installing Homebrew...
remote: Counting objects: 230481, done.
remote: Compressing objects: 100% (60411/60411), done.
remote: Total 230481 (delta 168814), reused 230474 (delta 168810)
Receiving objects: 100% (230481/230481), 52.92 MiB | 744.00 KiB/s, done.
Resolving deltas: 100% (168814/168814), done.
From https://github.com/Homebrew/homebrew
 * [new branch]      master     -> origin/master
error: unable to unlink old 'share/doc/homebrew/Acceptable-Formulae.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Bottles.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Brew-Test-Bot-For-Core-Contributors.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Brew-Test-Bot.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/C++-Standard-Libraries.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Common-Issues-for-Core-Contributors.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Common-Issues.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Custom-GCC-and-cross-compilers.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/External-Commands.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/FAQ.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Formula-Cookbook.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Gems,-Eggs-and-Perl-Modules.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Homebrew-0.8.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Homebrew-0.9.3.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Homebrew-0.9.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Homebrew-2.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Homebrew-and-Python.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/How-To-Open-a-Homebrew-Pull-Request-(and-get-it-merged).md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/How-to-build-software-outside-Homebrew-with-Homebrew-keg-only-dependencies.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Installation.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Interesting-Taps-&-Branches.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Maintainer-Guidelines.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Press.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Python-for-Formula-Authors.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Querying-Brew.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/README.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/The-brew-command.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Tips-N'-Tricks.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Troubleshooting.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Xcode.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/brew-tap.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/brew-test-bot-failed-jenkins.png' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/brew-test-bot-failed-pr.png' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/brew-test-bot-failed-test.png' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/brew-test-bot-for-core-contributors-block.png' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/brew-test-bot-for-core-contributors-console.png' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/brew-test-bot-for-core-contributors-tabs.png' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/brew-test-bot-for-core-contributors-trigger.png' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/brew-test-bot-passed-jenkins.png' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/brew-test-bot-passed-pr.png' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/brew-test-bot-triggered-pr.png' (Permission denied)
fatal: Could not reset index file to revision 'origin/master'.
Failed during: git reset --hard origin/master
这就是它给我的错误。 我已经卸载了旧的自制软件“rm-rf/usr/local/ceral/usr/local/.git&&brew cleanup”,更改了文件权限,在/usr/local/中更改了文件“库上的chown-R$USER”,移动了旧文件

cd /usr/local
# Moving old stuff out of the way.
sudo mv -v Library Library.old
# Now run Homebrew install script again.

正如github问题()中所建议的那样。这一切都不管用!想法???

好吧,显然我的权限和其他事情都搞砸了。我的卸载是成功的,但是我在重新安装Homebrew时遇到了相同的错误(如原始问题中所列)。但是,在尝试安装之后,我仍然可以运行brew doctor,这给了我以下错误

Alex-Taipales-MacBook:~ alextaipale$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: You have uncommitted modifications to Homebrew
If this a surprise to you, then you should stash these modifications.
Stashing returns Homebrew to a pristine state but can be undone
should you later need to do so for some reason.
     cd /usr/local/Library && git stash && git clean -d -f
Alex-Taipales-MacBook:~ alextaipale$ cd /usr/local/Library && git stash && git clean -d -f
fatal: bad revision 'HEAD'
fatal: bad revision 'HEAD'
fatal: Needed a single revision
You do not have the initial commit yet
Alex-Taipales-MacBook:Library alextaipale$ cd /usr/local/Library
Alex-Taipales-MacBook:Library alextaipale$ git show HEAD
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

完全删除自制软件和相关软件包并重新开始可以吗?如果是,请尝试此脚本,谢谢!我试过了,但出现了一个错误——见下文。我也尝试过卸载-,它给出了相同的结果“无法如上所述取消旧的“共享..”链接。”Alex Taipales MacBook:local Alex Taipale$git签出主错误:以下未跟踪的工作树文件将被签出覆盖:.gitignore.yardopts CODEOFCONDUCT.md contribution.md LICENSE.txt Library/.rubocop.yml Library/Aliases/0mq Library/Aliases/4store'I在下面发布了答案,注意,使用它的风险自负。好吧,如果你只是想重新开始,那很好,给我发一些关于它如何进行的评论。哇,谢谢你的这篇文章。这正是我从旧macbook迁移到新macbook后遇到的问题。
Alex-Taipales-MacBook:Library alextaipale$ git remote -v
origin  https://github.com/Homebrew/homebrew (fetch)
origin  https://github.com/Homebrew/homebrew (push)
Alex-Taipales-MacBook:Library alextaipale$ cd /usr
Alex-Taipales-MacBook:usr alextaipale$ sudo rm -rf local
Password:
Alex-Taipales-MacBook:usr alextaipale$ sudo git clone https://github.com/Homebrew/homebrew.git
Cloning into 'homebrew'...
remote: Counting objects: 230841, done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 230841 (delta 8), reused 10 (delta 7)
Receiving objects: 100% (230841/230841), 53.17 MiB | 716.00 KiB/s, done.
Resolving deltas: 100% (168934/168934), done.
Checking connectivity... done.
Alex-Taipales-MacBook:usr alextaipale$ sudo mv homebrew local
Alex-Taipales-MacBook:usr alextaipale$ sudo chown -R $(whoami) /usr/local