Homebrew-使用總結(jié)
報錯
-
執(zhí)行
brew update命令,報錯:fatal: Could not resolve HEAD to a revision Already up-to-date.解決方法:
-
執(zhí)行:
brew update --verbose:執(zhí)行結(jié)果:
Checking if we need to fetch /opt/homebrew... Checking if we need to fetch /opt/homebrew/Library/Taps/homebrew/homebrew-core... Fetching /opt/homebrew... Updating /opt/homebrew... Branch 'master' set up to track remote branch 'master' from 'origin'. Switched to and reset branch 'master' Your branch is up to date with 'origin/master'. Switched to and reset branch 'stable' Current branch stable is up to date. Updating /opt/homebrew/Library/Taps/homebrew/homebrew-core... fatal: Could not resolve HEAD to a revision Already up-to-date. 打開報錯路徑:
cd /opt/homebrew/Library/Taps/homebrew/homebrew-core;-
執(zhí)行:
ls -al:執(zhí)行結(jié)果:
total 0 drwxr-xr-x 3 hsh admin 96 10 14 16:27 . drwxr-xr-x 3 hsh admin 96 10 14 16:27 .. drwxr-xr-x 12 hsh admin 384 10 15 14:12 .git -
執(zhí)行
git fetch --prune origin:執(zhí)行結(jié)果:
remote: Enumerating objects: 3, done. remote: Counting objects: 100% (2/2), done. remote: Total 3 (delta 2), reused 2 (delta 2), pack-reused 1 Unpacking objects: 100% (3/3), 1.54 KiB | 92.00 KiB/s, done. From https://github.com/Homebrew/homebrew-core * [new branch] update-tflint.rb-1634223541 -> origin/update-tflint.rb-1634223541 -
執(zhí)行
git pull --rebase origin master:執(zhí)行結(jié)果:
From https://github.com/Homebrew/homebrew-core * branch master -> FETCH_HEAD -
成功后即可執(zhí)行更新:
brew update:執(zhí)行結(jié)果:
Already up-to-date. -
之后便可正常執(zhí)行其他命令了
eg:
brew install rbenv ruby-build;
-
-
安裝或更新
brew報錯:fatal: unable to access ‘https://github.com/Homebrew/brew/’: LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443解決方法:
需要翻墻:
-
查看網(wǎng)絡(luò)設(shè)置里當(dāng)前網(wǎng)絡(luò)socks代理服務(wù)器的IP和端口號,如下截圖:
-
添加git全局配置;
-
可以在終端先運行如下命令查看當(dāng)前git配置:
cat ~/.gitconfig,看是否有如下兩項配置:http.proxy=socks5://127.0.0.1:6666 http.sslbackend=openssl -
如果沒有,在終端分別運行如下兩條命令添加配置:
git config --global http.sslBackend "openssl" // 端口號請使用自己本地socks端口號 git config --global http.proxy "socks5://127.0.0.1:1189" -
這時再查看gitconfig的配置,就有如下截圖中的配置項了:
[http] sslBackend = openssl proxy = socks5://127.0.0.1:1080
-
-
修改:
hosts文件:路徑在:/private/etc/hosts:添加:140.82.114.4 github.com 185.199.108.133 raw.githubusercontent.com 185.199.109.133 raw.githubusercontent.com 185.199.110.133 raw.githubusercontent.com 185.199.111.133 raw.githubusercontent.com 此時重新回去執(zhí)行安裝brew的命令就可以成功安裝
brew軟件了;如果之前安裝失敗過,此時再安裝可能會遇到錯誤,需要先卸載再安裝;
-
安裝成功以后想撤銷剛剛對gitconfig的配置,在終端運行如下命令:
git config --global --unset http.sslBackend git config --global --unset http.proxy
-
報錯:
curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to raw.githubusercontent.com:443 或者 fatal: unable to access github.com/Homebrew/br…: LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443解決方案:查詢資料后發(fā)現(xiàn)蘋果新系統(tǒng)安全提升,禁止了直接執(zhí)行遠(yuǎn)程腳本。 把腳本文件下載到本地來執(zhí)行就好:
將對應(yīng)的腳本文件下載以后,在終端切換到下載腳本所在目錄并執(zhí)行
bash install.sh/bash uninstall.sh進(jìn)行安裝/卸載;