問題: 今天在mac上安裝Kotlin命令行編譯器的時候發(fā)現(xiàn) brew update
命令執(zhí)行之后長時間無響應(yīng) (因為brew的官方源被墻或速度慢)
解決辦法: 更新brew的鏡像源
- 查看brew的當前源:
執(zhí)行下面命令可以看到, brew的官方鏡像源為: https://github.com/Homebrew/homebrew
cd /usr/local
git remote -v
- 更改brew鏡像源
cd /usr/local
git remote set-url origin git://mirrors.tuna.tsinghua.edu.cn/homebrew.git
可以選擇下面鏡像源中的一個 (第一個親測可用)
清華鏡像源: git://mirrors.tuna.tsinghua.edu.cn/homebrew.git
中科大鏡像源: http://mirrors.ustc.edu.cn/homebrew.git
- 更新brew鏡像源之后再執(zhí)行
brew update
, 這時提示你刪除下面目錄:
/usr/local/share/doc/homebrew
那就刪除此目錄:rm -rf /usr/local/share/doc/homebrew
此時再此執(zhí)行brew update
就會成功了. 這時就可以開心地更新的你的庫brew upgrade [FORMULA...]
或者 安裝其他庫了brew install FORMULA...
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
安裝Kotlin命令行編譯器:
brew update
brew install kotlin
安裝后, 執(zhí)行kotlinc -version
, 如果此命令輸出類似下面這樣的信息, 說明kotlin命令行編譯器安裝成功:
info: kotlinc-jvm 1.1.60 (JRE 1.8.0_77-b03)
References:
https://brew.sh/
http://kotlinlang.org/docs/tutorials/command-line.html