簡體   English   中英

第一次安裝Cocoapods出現問題

[英]Trouble installing Cocoapods for first time

我正在嘗試使用以下方法安裝 cocoapods:

sudo install cocoapods

這就是我收到的回復

usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 file2
       install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 ... fileN directory
       install -d [-v] [-g group] [-m mode] [-o owner] directory ...

這是我第二次嘗試安裝 cocoapods。 第一次嘗試安裝失敗,說我可能需要安裝ruby-dev? 我嘗試安裝它,然后開始收到上述消息。

安裝Cocoapods的正確命令是:

sudo gem install cocoapods

如他們的入門頁面所示。

謝謝:使用“gem”后,我遇到了以下問題:

    Building native extensions. This could take a while...
ERROR:  Error installing cocoapods:
    ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.12.2/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20200415-22388-129pjat.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/include/ruby.h

You might have to install separate package for the ruby development
environment, ruby-dev or ruby-devel for example.

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.12.2 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/ffi-1.12.2/gem_make.out

我發現我需要使用 xcode 安裝一些額外的項目:

xcode-select --install

安裝並重新啟動計算機大約 20 分鍾后,我就可以使用:

sudo gem install cocoapods

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM