其他分享
首页 > 其他分享> > 记录cocoapods 的一次报错

记录cocoapods 的一次报错

作者:互联网

使用pod init 出现bad interpreter: No such file or directory

 

导致这个问题出现的原因,升级了macOS系统造成的cocoapods不能正常使用

So,就跟着更新一遍就好了,然而...

 

 

$ sudo gem update --system

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

 

当执行 $ sudo gem install cocoapods -n/usr/local/bin, 报错了

 

 

You might have to install separate package for the ruby development environm

具体更多的输出信息:

/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 ./siteconf20200430-75028-3e0jka.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-select --install 

 

然而,提示 “不能安装该软件因为当前无法从软件更新服务器获得

 

解决办法: 

1)升级xcode到最新版本,然后执行xcode-select –install 

2)或者去developer apple网站上手工下载对应版本的 Command Line Tools

 

好,以为这样可以了,执行pod init 

 

报错:

 

Traceback (most recent call last):

5: from /usr/local/bin/pod:23:in `<main>'

4: from /usr/local/bin/pod:23:in `load'

3: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.5.3/bin/pod:55:in `<top (required)>'

2: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:49:in `run'

1: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:130:in `verify_minimum_git_version!'

/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:118:in `git_version': Failed to extract git version from `git --version` ("xcrun: error: active developer path (\"/Applications/Xcode11.1.app/Contents/Developer\") does not exist\nUse `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.\nSee `man xcode-select` for more details.\n") (RuntimeError)

 

 

此时执行 sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

完成,究其原因,因为此Xcode是通过developer 下载,原来的又是拖动删除,导致路径错误。

 

标签:Ruby,记录,cocoapods,Library,报错,install,ruby,2.6
来源: https://www.cnblogs.com/LiuZX90/p/16359464.html