折腾:
【未解决】Win中VMWare中macOS虚拟机中安装homebrew
期间,去安装:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
后续log是:
==> /usr/bin/sudo /usr/bin/touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress ==> Installing Command Line Tools (macOS Mojave version 10.14) for Xcode-10.3 ==> /usr/bin/sudo /usr/sbin/softwareupdate -i Command\ Line\ Tools\ (macOS\ Mojave\ version\ 10.14)\ for\ Xcode-10.3 Software Update Tool Downloading Command Line Tools (macOS Mojave version 10.14) for Xcode Downloaded Command Line Tools (macOS Mojave version 10.14) for Xcode Installing Command Line Tools (macOS Mojave version 10.14) for Xcode Done with Command Line Tools (macOS Mojave version 10.14) for Xcode Done. ==> /usr/bin/sudo /bin/rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress ==> /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools ==> Downloading and installing Homebrew... remote: Enumerating objects: 50, done. remote: Counting objects: 100% (50/50), done. remote: Compressing objects: 100% (49/49), done. remote: Total 138567 (delta 1), reused 46 (delta 1), pack-reused 138517 Receiving objects: 100% (138567/138567), 34.15 MiB | 32.00 KiB/s, done. Resolving deltas: 100% (101867/101867), done. From https://github.com/Homebrew/brew * [new branch] dependabot/bundler/docs/parallel-1.19.2 -> origin/dependabot/bundler/docs/parallel-1.19.2 * [new branch] master -> origin/master * [new tag] 0.1 -> 0.1 * [new tag] 0.2 -> 0.2 ... * [new tag] 2.3.0 -> 2.3.0 * [new tag] 2.4.0 -> 2.4.0 HEAD is now at 67c843b91 Merge pull request #7770 from bayandin/revert-java-improvements ==> Downloading https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.6.3_1.yosemite.bottle.tar.gz ######################################################################## 100.0% ==> Pouring portable-ruby-2.6.3_1.yosemite.bottle.tar.gz ==> Homebrew is run entirely by unpaid volunteers. Please consider donating: https://github.com/Homebrew/brew#donations ==> Tapping homebrew/core Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'... remote: Enumerating objects: 49, done. remote: Counting objects: 100% (49/49), done. remote: Compressing objects: 100% (33/33), done. error: RPC failed; curl 18 transfer closed with outstanding read data remaining fatal: the remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core` exited with 128. Error: Failure while executing; `/usr/local/bin/brew tap homebrew/core` exited with 1. Failed during: /usr/local/bin/brew update --force ==> Installation successful! ==> Homebrew has enabled anonymous aggregate formulae and cask analytics. Read the analytics documentation (and how to opt-out) here: https://docs.brew.sh/Analytics No analytics data has been sent yet (or will be during this `install` run). ==> Homebrew is run entirely by unpaid volunteers. Please consider donating: https://github.com/Homebrew/brew#donations ==> Next steps: - Run `brew help` to get started - Further documentation: https://docs.brew.sh
报错error了。
算了,重新试一遍:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
然后卡死
crifanlideMac:~ crifanli$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" Password: ==> 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 ==> The following existing directories will be made writable by user only: /usr/local/share/zsh /usr/local/share/zsh/site-functions Press RETURN to continue or any other key to abort ==> /usr/bin/sudo /bin/chmod u+rwx /usr/local/share/zsh /usr/local/share/zsh/site-functions ==> /usr/bin/sudo /bin/chmod 755 /usr/local/share/zsh /usr/local/share/zsh/site-functions ==> Downloading and installing Homebrew... remote: Enumerating objects: 106, done. remote: Counting objects: 100% (106/106), done. remote: Compressing objects: 100% (5/5), done. remote: Total 134 (delta 101), reused 105 (delta 101), pack-reused 28 Receiving objects: 100% (134/134), 32.39 KiB | 26.00 KiB/s, done. Resolving deltas: 100% (101/101), completed with 50 local objects. From https://github.com/Homebrew/brew 67c843b91..634c45712 master -> origin/master HEAD is now at 634c45712 Merge pull request #7778 from jonchang/pr-pull-auto-mirror ==> Tapping homebrew/core Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
继续等待
另外通过
BREW_REPO=" https://github.com/Homebrew/brew "
也的确是这个仓库:
搜:
Cloning into ‘/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
都显示是源太慢,换源
请Control + C中断脚本执行如下命令:
速度暴快
crifanlideMac:~ crifanli$ brew --repo /usr/local/Homebrew crifanlideMac:~ crifanli$ cd "$(brew --repo)/Library/Taps/" crifanlideMac:Taps crifanli$ mkdir homebrew && cd homebrew crifanlideMac:homebrew crifanli$ git clone git://mirrors.ustc.edu.cn/homebrew-core.git Cloning into 'homebrew-core'... remote: Enumerating objects: 736295, done. remote: Total 736295 (delta 0), reused 0 (delta 0) Receiving objects: 100% (736295/736295), 238.62 MiB | 10.41 MiB/s, done. Resolving deltas: 31% (153411/490790)
cask 同样也有安装失败或者卡住的问题,解决方法也是一样:
cd "$(brew --repo)/Library/Taps/" cd homebrew git clone https://mirrors.ustc.edu.cn/homebrew-cask.git
此处log
crifanlideMac:homebrew crifanli$ cd "$(brew --repo)/Library/Taps/" crifanlideMac:Taps crifanli$ cd homebrew crifanlideMac:homebrew crifanli$ git clone https://mirrors.ustc.edu.cn/homebrew-cask.git Cloning into 'homebrew-cask'... remote: Enumerating objects: 446978, done. remote: Total 446978 (delta 0), reused 0 (delta 0) Receiving objects: 100% (446978/446978), 270.00 MiB | 8.87 MiB/s, done. Resolving deltas: 100% (319617/319617), done. Checking out files: 100% (3678/3678), done.
继续:
/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"
马上就安装完成了:
crifanlideMac:homebrew crifanli$ /usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/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... remote: Enumerating objects: 262, done. remote: Counting objects: 100% (262/262), done. remote: Compressing objects: 100% (53/53), done. remote: Total 262 (delta 196), reused 262 (delta 196) Receiving objects: 100% (262/262), 28.14 KiB | 9.38 MiB/s, done. Resolving deltas: 100% (196/196), completed with 96 local objects. From https://mirrors.ustc.edu.cn/brew * [new tag] 1.16 -> 1.16 * [new tag] backup/brew-cask-style-14-54-55 -> backup/brew-cask-style-14-54-55 * [new tag] backup/create-cache-00-29-47 -> backup/create-cache-00-29-47 * [new tag] backup/days-03-02-52 -> backup/days-03-02-52 * [new tag] backup/days-03-02-59 -> backup/days-03-02-59 * [new tag] backup/days-19-30-23 -> backup/days-19-30-23 * [new tag] backup/gpg-verification-01-53-16 -> backup/gpg-verification-01-53-16 * [new tag] backup/remove-popen-read-19-56-50 -> backup/remove-popen-read-19-56-50 * [new tag] backup/remove-popen-read-20-00-21 -> backup/remove-popen-read-20-00-21 HEAD is now at 634c45712 Merge pull request #7778 from jonchang/pr-pull-auto-mirror Already up-to-date. ==> Installation successful! ==> Homebrew has enabled anonymous aggregate formulae and cask analytics. Read the analytics documentation (and how to opt-out) here: https://docs.brew.sh/Analytics ==> Homebrew is run entirely by unpaid volunteers. Please consider donating: https://github.com/Homebrew/brew#donations ==> Next steps: - Run `brew help` to get started - Further documentation: https://docs.brew.sh
再去:
brew update
log
crifanlideMac:homebrew crifanli$ brew update Already up-to-date.
再去设置中科大源
先去看看此处的bash是哪个文件
crifanlideMac:homebrew crifanli$ ls ~/.bash* /Users/crifanli/.bash_history /Users/crifanli/.bash_sessions: 2B26EA22-5B95-4888-9824-CAA989C048E3.history 46796811-024C-4530-B17A-EBDC0B8F49D5.historynew 2B26EA22-5B95-4888-9824-CAA989C048E3.historynew C1FF76D8-2AF0-4673-B8C9-109F25853AC9.historynew 2B26EA22-5B95-4888-9824-CAA989C048E3.session D3BCC145-EB10-40EF-836C-751FAE20F626.history 46796811-024C-4530-B17A-EBDC0B8F49D5.history D3BCC145-EB10-40EF-836C-751FAE20F626.historynew
没有bashrc和bash_profile
crifanlideMac:homebrew crifanli$ git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git crifanlideMac:homebrew crifanli$ git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git crifanlideMac:homebrew crifanli$ git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git crifanlideMac:homebrew crifanli$ brew update Already up-to-date.
继续:
crifanlideMac:homebrew crifanli$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile crifanlideMac:homebrew crifanli$ ls ~/.bash_profile /Users/crifanli/.bash_profile crifanlideMac:homebrew crifanli$ source ~/.bash_profile
目前应该就是可以了。
crifanlideMac:homebrew crifanli$ brew --help Example usage: brew search [TEXT|/REGEX/] brew info [FORMULA...] brew install FORMULA... brew update brew upgrade [FORMULA...] brew uninstall FORMULA... brew list [FORMULA...] Troubleshooting: brew config brew doctor brew install --verbose --debug FORMULA Contributing: brew create [URL [--no-fetch]] brew edit [FORMULA...] Further help: brew commands brew help [COMMAND] man brew https://docs.brew.sh crifanlideMac:homebrew crifanli$ brew --version Homebrew 2.4.0 Homebrew/homebrew-core (git revision c358c3; last commit 2020-06-22) Homebrew/homebrew-cask (git revision bf444; last commit 2020-06-22)
【总结】
macOS中用默认的官网命令去安装brew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
会卡死在
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
原因:官网内部会去下载
https://github.com/Homebrew/brew
由于国内网络连接速度及其慢,导致卡死,长期没进度
解决办法:
换源,比如国内的,中科大的源
步骤:
直接Control+C中断
再去:
下载homebrew-core
cd "$(brew --repo)/Library/Taps/" mkdir homebrew && cd homebrew git clone git://mirrors.ustc.edu.cn/homebrew-core.git
同样的,下载homebrew-cask
cd "$(brew --repo)/Library/Taps/" cd homebrew git clone https://mirrors.ustc.edu.cn/homebrew-cask.git
之后,不用官网命令了,换别人的命令(内部主要就是换了源):
/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"
很快(此处没2分钟)就完成了,显示:
==> Installation successful!
最后去更新一下
brew update
此处即可。
不过顺带再去更换源为中科大
git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git brew update
以及长期替换homebrew-bottles:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile source ~/.bash_profile
即可。
转载请注明:在路上 » 【已解决】macOS安装homebrew卡死在:Cloning into /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core