Cocopods 常见报错

error1.

系统:10.13.6
命令:sudo gem install cocoapods

ERROR:  While executing gem ... (Gem::FilePermissionError)     You don't have write permissions for the /usr/bin directory.

执行此命令即可

sudo gem install cocoapods -n /usr/local/bin

error2.

系统:10.14.6
命令:sudo gem install cocoapods

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

    current directory: /Library/Ruby/Gems/2.3.0/gems/ffi-1.11.1/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -I /Library/Ruby/Site/2.3.0 -r ./siteconf20191022-2775-1q9uxye.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

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

解决办法:执行下面命令按提示执行

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

error3.

[!] CDN: trunk Repo update failed - 24 error(s):

解决办法:Podfile文件中添加下面代码

source 'https://github.com/CocoaPods/Specs.git'

如果pod search有些库不正常,可以执行:

pod repo remove trunk

你可能感兴趣的:(Cocopods 常见报错)