新买的 Mac Studio 还未安装过 CocoaPods,因为最近开发的项目都是用 Swift Package Manager。目前仍然有很多项目是使用 CocoaPods,今天从 GitHub 上 Clone 了一个 App 就是使用 CocoaPods。我的一般都是直接安装官网的方式去安装,没必要百度和 Google,但是安装官网的安装命令 sudo gem install cocoapods 安装,是能安装成功的,但是使用时却报错了:
1 2 3 4 5 6 7 8 9 10 11 12
$ pod install Analyzing dependencies Adding spec repo `trunk` with CDN `https://cdn.cocoapods.org/` /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi/library.rb:275: [BUG] Bus Error at 0x00000001046b4000 ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]
-- Crash Report log information -------------------------------------------- See Crash Report log file under the one of following: * ~/Library/Logs/DiagnosticReports * /Library/Logs/DiagnosticReports for more details. Don't forget to include the above Crash Report log file in bug reports.
# gan @ ganzhixacstudio in ~ [17:10:48] $ gem install ffi Fetching ffi-1.15.5.gem ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory. # gan @ ganzhixacstudio in ~ [17:12:26] C:1 $ sudo gem install ffi Password: Building native extensions. This could take a while... Successfully installed ffi-1.15.5 Parsing documentation for ffi-1.15.5 Done installing documentation for ffi after 3 seconds 1 gem installed
Fetching cocoapods-core-1.11.3.gem Fetching cocoapods-deintegrate-1.0.5.gem Fetching cocoapods-downloader-1.6.3.gem Fetching cocoapods-plugins-1.0.0.gem Fetching cocoapods-search-1.0.1.gem Fetching cocoapods-trunk-1.6.0.gem Fetching cocoapods-try-1.2.0.gem Fetching cocoapods-1.11.3.gem Successfully installed cocoapods-core-1.11.3 Successfully installed cocoapods-deintegrate-1.0.5 Successfully installed cocoapods-downloader-1.6.3 Successfully installed cocoapods-plugins-1.0.0 Successfully installed cocoapods-search-1.0.1 Successfully installed cocoapods-trunk-1.6.0 Successfully installed cocoapods-try-1.2.0 Successfully installed cocoapods-1.11.3 Parsing documentation for cocoapods-core-1.11.3 Installing ri documentation for cocoapods-core-1.11.3 Parsing documentation for cocoapods-deintegrate-1.0.5 Installing ri documentation for cocoapods-deintegrate-1.0.5 Parsing documentation for cocoapods-downloader-1.6.3 Installing ri documentation for cocoapods-downloader-1.6.3 Parsing documentation for cocoapods-plugins-1.0.0 Installing ri documentation for cocoapods-plugins-1.0.0 Parsing documentation for cocoapods-search-1.0.1 Installing ri documentation for cocoapods-search-1.0.1 Parsing documentation for cocoapods-trunk-1.6.0 Installing ri documentation for cocoapods-trunk-1.6.0 Parsing documentation for cocoapods-try-1.2.0 Installing ri documentation for cocoapods-try-1.2.0 Parsing documentation for cocoapods-1.11.3 Installing ri documentation for cocoapods-1.11.3 Done installing documentation for cocoapods-core, cocoapods-deintegrate, cocoapods-downloader, cocoapods-plugins, cocoapods-search, cocoapods-trunk, cocoapods-try, cocoapods after 2 seconds 8 gems installed
# gan @ ganzhixacstudio in ~ [17:13:04] $ pod --version 1.11.3
5. 尝试搜索包
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
$ pod search AFNetworking /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi/library.rb:275: [BUG] Bus Error at 0x0000000100274000 ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]
-- Crash Report log information -------------------------------------------- See Crash Report log file under the one of following: * ~/Library/Logs/DiagnosticReports * /Library/Logs/DiagnosticReports for more details. Don't forget to include the above Crash Report log file in bug reports. -- Control frame information ----------------------------------------------- c:0036 p:---- s:0222 e:000221 CFUNC :attach c:0035 p:0258 s:0216 e:000215 METHOD /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi/library.rb:275 c:0034 p:0050 s:0196 e:000195 CLASS /Library/Ruby/Gems/2.6.0/gems/ethon-0.15.0/lib/ethon/libc.rb:17
6. 还是报错
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
$ pod search AFNetworking /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi/library.rb:275: [BUG] Bus Error at 0x0000000100274000 ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]
-- Crash Report log information -------------------------------------------- See Crash Report log file under the one of following: * ~/Library/Logs/DiagnosticReports * /Library/Logs/DiagnosticReports for more details. Don't forget to include the above Crash Report log file in bug reports. -- Control frame information ----------------------------------------------- c:0036 p:---- s:0222 e:000221 CFUNC :attach c:0035 p:0258 s:0216 e:000215 METHOD /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi/library.rb:275 c:0034 p:0050 s:0196 e:000195 CLASS /Library/Ruby/Gems/2.6.0/gems/ethon-0.15.0/lib/ethon/libc.rb:17
# gan @ ganzhixacstudio in ~ [17:26:04] $ curl google.com <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8"> <TITLE>301 Moved</TITLE></HEAD><BODY> <H1>301 Moved</H1> The document has moved <A HREF="http://www.google.com/">here</A>. </BODY></HTML>
# gan @ ganzhixacstudio in ~ [17:26:07] $ brew install cocoapods