首次安装Cocoapods时遇到问题

时间:2020-04-15 15:40:00

标签: terminal installation cocoapods

我正在尝试使用以下方法安装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?我尝试安装该软件,然后开始接收上述消息。

2 个答案:

答案 0 :(得分:0)

安装Cocoapods的正确命令是:

sudo gem install cocoapods

如其Getting Started页上所示。

答案 1 :(得分:0)

谢谢!使用“宝石”后,我遇到了以下问题:

    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