Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lch88 opened this issue Jun 6, 2017 · 12 comments
Closed

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

lch88 opened this issue Jun 6, 2017 · 12 comments
Labels
s1:awaiting input Waiting for input from the original author

Comments

@lch88
Copy link

lch88 commented Jun 6, 2017

Report

What did you do?

Run pod install or whatever starts with pod

What did you expect to happen?

pod xxx should run pod command corresponding to xxx.
In case of pod install, it should install all pod dependencies correctly.

What happened instead?

Fails with following one-line error message
zsh: /usr/local/bin/pod: bad interpreter: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin: no such file or directory

The reason seems to be change of system ruby version to 2.3. The path is moved to /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin.

CocoaPods Environment

*pod env doesn't work either.

macOS 10.13 (17A264c) High Sierra Developer Beta
CocoaPod 1.2.1

Project that demonstrates the issue

Not tied to certain project setting.

@dnkoutso
Copy link
Contributor

dnkoutso commented Jun 6, 2017

Nice thanks for the report. Will investigate.

@dnkoutso
Copy link
Contributor

dnkoutso commented Jun 6, 2017

@lch88 it does not seem we hardcode the Ruby path anywhere for this to be caused...wonder if it's a High Sierra update issue.

@lch88
Copy link
Author

lch88 commented Jun 6, 2017

I've just tried to solve it, and It seems that the issue happens when upgrading from Sierra to High Sierra. System ruby version is upgraded but the version imprinted inside pod script doesn't change.
I'm not a ruby developer so not sure how that got there but reinstalling would solve it for now.
but feels like there should be some automatic migrator or guide or sort for users who are upgrading.

@dnkoutso
Copy link
Contributor

dnkoutso commented Jun 6, 2017

but the version imprinted inside pod script doesn't change.

Thats the script code:
https://github.com/CocoaPods/CocoaPods/blob/master/bin/pod

@dnkoutso
Copy link
Contributor

dnkoutso commented Jun 6, 2017

@lch88 do other ruby commands work for you, irrelevant to cocoapods?

@dnkoutso dnkoutso added the s1:awaiting input Waiting for input from the original author label Jun 6, 2017
@lch88
Copy link
Author

lch88 commented Jun 6, 2017

@dnkoutso
Other ruby commands works fine. However I didn't try something installed via gem. So this might happens to other CLI tools or libraries installed via gem in Sierra, but I have nothing much to test on my Mac.
Here's the pod script which actually get executed currently.

$ cat `which pod`
#!/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
#
# This file was generated by RubyGems.
#
# The application 'cocoapods' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

version = ">= 0.a"

if ARGV.first
  str = ARGV.first
  str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
  if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
    version = $1
    ARGV.shift
  end
end

load Gem.bin_path('cocoapods', 'pod', version)

The first line was #!/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby before reinstallation. I guess this auto-generated file could be the culprit.

@dnkoutso
Copy link
Contributor

dnkoutso commented Jun 6, 2017

@orta or @segiddins any thoughts on this? I am reaching my limit on Ruby and rubygems knowledge.

@segiddins
Copy link
Member

Try reinstalling, gem install cocoapods.

@lch88
Copy link
Author

lch88 commented Jun 6, 2017

@segiddins Yup. Reinstalling solves this and already did. Maybe I wasn't really clear enough up there 😅
It's perfectly okay to close this issue since it's resolved but I was just curious what could be done on CocoaPods side to prevent this sudden break or smooth it out.

@dnkoutso
Copy link
Contributor

dnkoutso commented Jun 6, 2017

@lch88 not sure. I will be closing but keeping an eye out for future reports. Thank you for trying it out on the latest macOS!

@dnkoutso dnkoutso closed this as completed Jun 6, 2017
@segiddins
Copy link
Member

Nothing, that's a downside of RubyGems hardcoding in a path rather than using /usr/bin/env ruby

@orta
Copy link
Member

orta commented Jun 6, 2017

Which, just in case more people find this, is not a CocoaPods issue (and it might get fixed in later betas) - the re-install recommendation is really the only option here.

For re-install instructions check: #6898 (comment)

@CocoaPods CocoaPods locked and limited conversation to collaborators Jun 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
s1:awaiting input Waiting for input from the original author
Projects
None yet
Development

No branches or pull requests

4 participants