Homebrew是 macOS(或 Linux)缺失的軟件包的管理器
**正常情況下在命令行執行 **
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
即可完成安裝。
但由于某些你懂的因素
,導致GitHub的raw.githubusercontent.com
域名解析被污染了。(即使你翻墻了也不能正常操作)
解決方法
直接使用這個開源腳本一鍵解決:
https://gitee.com/cunkai/HomebrewCN
HomebrewCN
Homebrew 國內自動安裝腳本
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
錯誤二
安裝RVM時報錯 curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
curl -L get.rvm.io | bash -s stable
執行這個命令 需要 修改這個文件/etc/hosts
的文件
解決辦法:
mac終端中輸入
sudo vi /etc/hosts
#Host Database
#localhost is used to configure the loopback interface
#when the system is booting. Do not change this entry.
127.0.0.1 localhost
255.255.255.255 broadcasthost
#GitHub Start
52.74.223.119 github.com
192.30.253.119 gist.github.com
54.169.195.247 api.github.com
185.199.111.153 assets-cdn.github.com
151.101.76.133 raw.githubusercontent.com
151.101.108.133 user-images.githubusercontent.com
151.101.76.133 gist.githubusercontent.com
151.101.76.133 cloud.githubusercontent.com
151.101.76.133 camo.githubusercontent.com
151.101.76.133 avatars0.githubusercontent.com
151.101.76.133 avatars1.githubusercontent.com
151.101.76.133 avatars2.githubusercontent.com
151.101.76.133 avatars3.githubusercontent.com
151.101.76.133 avatars4.githubusercontent.com
151.101.76.133 avatars5.githubusercontent.com
151.101.76.133 avatars6.githubusercontent.com
151.101.76.133 avatars7.githubusercontent.com
151.101.76.133 avatars8.githubusercontent.com
#GitHub End
hosts —— the static table lookup for host name(主機名查詢靜態表)。
hosts文件是Linux系統上一個負責ip地址與域名快速解析的文件,以ascii格式保存在/etc/目錄下。hosts文件包含了ip地址與主機名之間的映射,還包括主機的別名。在沒有域名解析服務器的情況下,系統上的所有網絡程序都通過查詢該文件來解析對應于某個主機名的ip地址,否則就需要使用dns服務程序來解決。通過可以將常用的域名和ip地址映射加入到hosts文件中,實現快速方便的訪問。
優先級 : dns緩存 > hosts > dns服務
hosts格式配置
hosts文件可以配置主機ip與對應的主機名。在局域網或者是萬維網上,每臺主機都有一個ip地址,它區分開每臺主機,并可以根據ip進行通訊。但是Ip地址不符合人腦的記憶規律,因此出現了域名,例如www.baidu.com.在一個局域網中,每臺機器都有一個主機名,用于區分主機,便于相互訪問。
hosts文件格式
ip地址 主機名/域名 (主機別名)
主機名和域名的區別在于:
主機名通常在局域網內使用,通過hosts文件,主機名就被解析到對應的ip。
域名通常在internet上使用,但是優先級低于hosts文件中內容,因此如果你不想使用internet上的域名解析,可以更改自己的hosts文件,加入自己的域名解析。
hosts文件作用
錯誤三:提示信息是:svn:錯誤:Xcode不再提供subversion命令行工具
當前機器版本是Mac 10.15.4,已經不再提供SVN的版本管理工具,這里刪除掉整個工具路徑即可。
刪除命令:
<pre style="margin: 0px; padding: 0px; word-wrap: break-word; font-family: "Courier New" !important; font-size: 12px !important;">rm -rf /Library/Developer/CommandLineTools</pre>
使用brew安裝下,插件傳送門 https://brew.sh/ :
<pre style="margin: 0px; padding: 0px; word-wrap: break-word; font-family: "Courier New" !important; font-size: 12px !important;">brew install subversion</pre>
查詢當前已經安裝版本信息:
<pre style="margin: 0px; padding: 0px; word-wrap: break-word; font-family: "Courier New" !important; font-size: 12px !important;">svn --version 或者 svnserve --version 分別如下圖展示使用的svn版本信息</pre>
錯誤四:xcrun: error: unable to find utility "simctl", not a developer tool or in PATH
解決:解決方案就是去xcode設置里面,將Command line Tools設置一下,在Xcode>preferences>Locations里面,設置之后再運行終端即可
注意:Cocoapods 1.7以后,執行pod setup以后,不會創建master的目錄了。執行源文件目錄
第一步分析 Podfile 里面的 source ,如果沒有走默認 Cocoapods 的配置(1.8 以上是 https://cdn.cocoapods.org ,之前的還是 Cocoapods/Spec), 如果本地不存在官方 cdn 的 repo 名字是 trunk 的保留字,自己無法創建。如果有自定義的 source 會追加上去 sources 列表。