最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】用了Cocoapods的Xcode项目编译出错:zsh /usr/local/bin/pod bad interpreter

Cocoapods crifan 4947浏览 0评论

不论是打开:xxx.xcodeproj去编译

还是(后来想起来需要去)打开:xxx.xcworkspace

结果去编译都是出错:

PhaseScriptExecution Check\ Pods\ Manifest.lock /Users/crifan/Library/Developer/Xcode/DerivedData/INQuzhou-gsaoinqswpvjtsarjilxvzlvasch/Build/Intermediates.noindex/INQuzhou.build/Debug-iphonesimulator/INQuzhou.build/Script-E63CFFF49D1FB21A13D370A0.sh

    cd /Users/crifan/dev/dev_root/daryun/Projects/inquzhou/sourcecode/iOS/inquzhou

    /bin/sh -c /Users/crifan/Library/Developer/Xcode/DerivedData/INQuzhou-gsaoinqswpvjtsarjilxvzlvasch/Build/Intermediates.noindex/INQuzhou.build/Debug-iphonesimulator/INQuzhou.build/Script-E63CFFF49D1FB21A13D370A0.sh

diff: /Users/crifan/dev/dev_root/daryun/Projects/inquzhou/sourcecode/iOS/inquzhou/Pods/../Podfile.lock: No such file or directory

error: The sandbox is not in sync with the Podfile.lock. Run ‘pod install’ or update your CocoaPods installation.

然后出错:

➜  inquzhou pwd

/Users/crifan/dev/dev_root/daryun/Projects/inquzhou/sourcecode/iOS/inquzhou

➜  inquzhou ll

total 16

drwxr-xr-x@ 17 crifan  staff   544B 12 11 14:41 INQuzhou

drwxr-xr-x@ 10 crifan  staff   320B 12 11 14:42 INQuzhou.xcodeproj

drwxr-xr-x@  4 crifan  staff   128B 12 12 09:53 INQuzhou.xcworkspace

drwxr-xr-x@  4 crifan  staff   128B 12 11 14:41 INQuzhouTests

drwxr-xr-x@  4 crifan  staff   128B 12 11 14:41 INQuzhouUITests

-rw-r–r–@  1 crifan  staff   824B 12 11 18:33 Podfile

drwxr-xr-x@ 18 crifan  staff   576B 12 11 18:33 Pods

-rw-r–r–@  1 crifan  staff    11B 12 11 14:41 README.md

➜  inquzhou pod install

zsh: /usr/local/bin/pod: bad interpreter: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin: no such file or directory

zsh: /usr/local/bin/pod: bad interpreter

CocoaPods CLI fails in High Sierra due to change of Ruby version · Issue #6778 · CocoaPods/CocoaPods

High Sierra: bad interpreter · Issue #6898 · CocoaPods/CocoaPods

貌似是升级了High Sierra 导致的

然后去:

sudo gem update –system

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

即:

➜  inquzhou sudo gem update –system

Password:

Updating rubygems-update

Fetching: rubygems-update-2.6.14.gem (100%)

Successfully installed rubygems-update-2.6.14

Parsing documentation for rubygems-update-2.6.14

Installing ri documentation for rubygems-update-2.6.14

Installing darkfish documentation for rubygems-update-2.6.14

Done installing documentation for rubygems-update after 38 seconds

Parsing documentation for rubygems-update-2.6.14

Done installing documentation for rubygems-update after 0 seconds

Installing RubyGems 2.6.14

RubyGems 2.6.14 installed

Parsing documentation for rubygems-2.6.14

Installing ri documentation for rubygems-2.6.14

=== 2.6.14 / 2017-10-09

Security fixes:

* Whitelist classes and symbols that are in loaded YAML.

  See CVE-2017-0903 for full details.

  Fix by Aaron Patterson.

=== 2.6.13 / 2017-08-27

Security fixes:

* Fix a DNS request hijacking vulnerability.

  Fix by Samuel Giddins.

* Fix an ANSI escape sequence vulnerability.

  Fix by Evan Phoenix.

* Fix a DOS vulernerability in the `query` command.

  Fix by Samuel Giddins.

* Fix a vulnerability in the gem installer that allowed

  a malicious gem to overwrite arbitrary files.

  Fix by Samuel Giddins.

=== 2.6.12 / 2017-04-30

Bug fixes:

<span style="font-size: 12px; color: rgb(51, 51, 51); font-family: Monaco;"–<—————————————————————————-

RubyGems installed the following executables:

    /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/gem

Ruby Interactive (ri) documentation was installed. ri is kind of like man

pages for ruby libraries. You may access it like this:

  ri Classname

  ri Classname.class_method

  ri Classname#instance_method

If you do not wish to install this documentation in the future, use the

<span style="font-size: 12px; color: rgb(51, 51, 51); font-family: Monaco;"–<no-document flag, or set it as the default in your ~/.gemrc file. See

‘gem help env’ for details.

RubyGems system software updated

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

Fetching: concurrent-ruby-1.0.5.gem (100%)

Successfully installed concurrent-ruby-1.0.5

Fetching: i18n-0.9.1.gem (100%)

Successfully installed i18n-0.9.1

Fetching: thread_safe-0.3.6.gem (100%)

Successfully installed thread_safe-0.3.6

Fetching: tzinfo-1.2.4.gem (100%)

Successfully installed tzinfo-1.2.4

Fetching: activesupport-4.2.10.gem (100%)

Successfully installed activesupport-4.2.10

Fetching: nap-1.1.0.gem (100%)

Successfully installed nap-1.1.0

Fetching: fuzzy_match-2.0.4.gem (100%)

Successfully installed fuzzy_match-2.0.4

Fetching: cocoapods-core-1.3.1.gem (100%)

Successfully installed cocoapods-core-1.3.1

Fetching: claide-1.0.2.gem (100%)

Successfully installed claide-1.0.2

Fetching: cocoapods-deintegrate-1.0.1.gem (100%)

Successfully installed cocoapods-deintegrate-1.0.1

Fetching: cocoapods-downloader-1.1.3.gem (100%)

Successfully installed cocoapods-downloader-1.1.3

Fetching: cocoapods-plugins-1.0.0.gem (100%)

Successfully installed cocoapods-plugins-1.0.0

Fetching: cocoapods-search-1.0.0.gem (100%)

Successfully installed cocoapods-search-1.0.0

Fetching: cocoapods-stats-1.0.0.gem (100%)

Successfully installed cocoapods-stats-1.0.0

Fetching: netrc-0.11.0.gem (100%)

Successfully installed netrc-0.11.0

Fetching: cocoapods-trunk-1.3.0.gem (100%)

Successfully installed cocoapods-trunk-1.3.0

Fetching: cocoapods-try-1.1.0.gem (100%)

Successfully installed cocoapods-try-1.1.0

Fetching: molinillo-0.5.7.gem (100%)

Successfully installed molinillo-0.5.7

Fetching: CFPropertyList-2.3.6.gem (100%)

Successfully installed CFPropertyList-2.3.6

Fetching: colored2-3.1.2.gem (100%)

Successfully installed colored2-3.1.2

Fetching: nanaimo-0.2.3.gem (100%)

Successfully installed nanaimo-0.2.3

Fetching: xcodeproj-1.5.3.gem (100%)

Successfully installed xcodeproj-1.5.3

Fetching: escape-0.0.4.gem (100%)

Successfully installed escape-0.0.4

Fetching: fourflusher-2.0.1.gem (100%)

Successfully installed fourflusher-2.0.1

Fetching: gh_inspector-1.0.3.gem (100%)

Successfully installed gh_inspector-1.0.3

Fetching: ruby-macho-1.1.0.gem (100%)

Successfully installed ruby-macho-1.1.0

Fetching: cocoapods-1.3.1.gem (100%)

Successfully installed cocoapods-1.3.1

Parsing documentation for concurrent-ruby-1.0.5

Installing ri documentation for concurrent-ruby-1.0.5

Parsing documentation for i18n-0.9.1

Installing ri documentation for i18n-0.9.1

Parsing documentation for thread_safe-0.3.6

Installing ri documentation for thread_safe-0.3.6

Parsing documentation for tzinfo-1.2.4

Installing ri documentation for tzinfo-1.2.4

Parsing documentation for activesupport-4.2.10

Installing ri documentation for activesupport-4.2.10

Parsing documentation for nap-1.1.0

Installing ri documentation for nap-1.1.0

Parsing documentation for fuzzy_match-2.0.4

Installing ri documentation for fuzzy_match-2.0.4

Parsing documentation for cocoapods-core-1.3.1

Installing ri documentation for cocoapods-core-1.3.1

Parsing documentation for claide-1.0.2

Installing ri documentation for claide-1.0.2

Parsing documentation for cocoapods-deintegrate-1.0.1

Installing ri documentation for cocoapods-deintegrate-1.0.1

Parsing documentation for cocoapods-downloader-1.1.3

Installing ri documentation for cocoapods-downloader-1.1.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.0

Installing ri documentation for cocoapods-search-1.0.0

Parsing documentation for cocoapods-stats-1.0.0

Installing ri documentation for cocoapods-stats-1.0.0

Parsing documentation for netrc-0.11.0

Installing ri documentation for netrc-0.11.0

Parsing documentation for cocoapods-trunk-1.3.0

Installing ri documentation for cocoapods-trunk-1.3.0

Parsing documentation for cocoapods-try-1.1.0

Installing ri documentation for cocoapods-try-1.1.0

Parsing documentation for molinillo-0.5.7

Installing ri documentation for molinillo-0.5.7

Parsing documentation for CFPropertyList-2.3.6

Installing ri documentation for CFPropertyList-2.3.6

Parsing documentation for colored2-3.1.2

Installing ri documentation for colored2-3.1.2

Parsing documentation for nanaimo-0.2.3

Installing ri documentation for nanaimo-0.2.3

Parsing documentation for xcodeproj-1.5.3

Installing ri documentation for xcodeproj-1.5.3

Parsing documentation for escape-0.0.4

Installing ri documentation for escape-0.0.4

Parsing documentation for fourflusher-2.0.1

Installing ri documentation for fourflusher-2.0.1

Parsing documentation for gh_inspector-1.0.3

Installing ri documentation for gh_inspector-1.0.3

Parsing documentation for ruby-macho-1.1.0

Installing ri documentation for ruby-macho-1.1.0

Parsing documentation for cocoapods-1.3.1

Installing ri documentation for cocoapods-1.3.1

Done installing documentation for concurrent-ruby, i18n, thread_safe, tzinfo, activesupport, nap, fuzzy_match, cocoapods-core, claide, cocoapods-deintegrate, cocoapods-downloader, cocoapods-plugins, cocoapods-search, cocoapods-stats, netrc, cocoapods-trunk, cocoapods-try, molinillo, CFPropertyList, colored2, nanaimo, xcodeproj, escape, fourflusher, gh_inspector, ruby-macho, cocoapods after 28 seconds

27 gems installed

然后再去:pod install

即可:

➜  inquzhou pod install

Analyzing dependencies

Downloading dependencies

Using AFNetworking (2.6.3)

Using MBProgressHUD (0.9.2)

Using MJRefresh (3.1.0)

Using RaptureXML@Gilt (1.0.11)

Using Realm (0.98.8)

Using SDWebImage (3.7.6)

Installing SSZipArchive 1.4 (was 1.2)

Using TCBlobDownload (2.1.1)

Installing UMengAnalytics 4.1.0 (was 3.6.6)

Using UMengSocial (5.0)

Using YYModel (1.0.3)

Generating Pods project

Integrating client project

Sending stats

Pod installation complete! There are 11 dependencies from the Podfile and 11 total pods installed.

【总结】

此处好像是Mac系统升级到了High Sierra后,去pod install出错:

zsh: /usr/local/bin/pod: bad interpreter

解决办法是:升级到最新版本

sudo gem update –system

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

即可。

转载请注明:在路上 » 【已解决】用了Cocoapods的Xcode项目编译出错:zsh /usr/local/bin/pod bad interpreter

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
84 queries in 0.203 seconds, using 22.05MB memory