Cocoapods: High Sierra: bad interpreter

Created on 25 Jul 2017  路  18Comments  路  Source: CocoaPods/CocoaPods

Report

What did you do?

Run pod

What did you expect to happen?

run

What happened instead?

-bash: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory

CocoaPods Environment

1.2.1

Similar to this report I am unable to use the pod command. However, unlike his report reinstalling does not fix the issue.

Most helpful comment

for all others:

gem install -n /usr/local/bin cocoapods

fixes it

All 18 comments

Seemed to have fixed it. Some combination of rbenv, and sudo xcode-select --switch /Applications/Xcode-beta.app. It seems it was searching /Users/justin/Applications/Xcode.app originally and finding no CL Dev tools

for all others:

gem install -n /usr/local/bin cocoapods

fixes it

bin/sh sudo gem update --system sudo gem install -n /usr/local/bin cocoapods

Actually if you are using Fastlane and have this issue with it, you can use the approach from @raisezhang . Just use fastlane instead of cocoapods in the last command.

Actually if you are using Fastlane and have this issue with it, you can use the approach from @raisezhang . Just use fastlane instead of cocoapods in the last command.

Try running ~/.fastlane/bin/fastlane env
@KrauseFx

After upgrading to macOS High Sierra, get it fixed with following commands:
sudo gem install cocoapods

Just installed High Sierra and had the above listed problem and used: sudo gem install cocoapods
Worked perfectly and I'm back in business. Thanks guys :)

(this help me)Try reinstalling:gem install cocoapods

Try this:

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

It's closed. Solved.

When I run gem update --system under root. I get a error :

Updating rubygems-update
Fetching: rubygems-update-2.7.2.gem (100%)
Successfully installed rubygems-update-2.7.2
Parsing documentation for rubygems-update-2.7.2
Installing ri documentation for rubygems-update-2.7.2
Installing darkfish documentation for rubygems-update-2.7.2
Done installing documentation for rubygems-update after 46 seconds
Parsing documentation for rubygems-update-2.7.2
Done installing documentation for rubygems-update after 0 seconds
Installing RubyGems 2.7.2
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/gem

Any suggestion?

I got this issue with both cocoapods and fastlane. Using @raisezhang solution fixed both

I too have the same problem as mentioned in the above post When I run gem update --system under root.

I am having the same issue as mentioned by @jiaokang, gem update --system giving error under root.

Not as root. Exec as normal user.
See my first comment or here

gem install -n /usr/local/bin cocoapods

OS X does not allow in system due to system integrate protection. Shure you can turn it off but thats a bad idea. And /usr/local/bin is correct for now.

@jiaokang , I've faced the same issue. My workaround was installing cocoapods via homebrew. (Since all gem based instructions were failing for me).

brew install cocoapods
brew link --overwrite cocoapods

P.S. The second instruction has been suggested by homebrew

Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/pod
Target /usr/local/bin/pod
already exists. You may want to remove it:
  rm '/usr/local/bin/pod'

To force the link and overwrite all conflicting files:
  brew link --overwrite cocoapods

To list all files that would be deleted:
  brew link --overwrite --dry-run cocoapods

And you have to pass -n /usr/local/bin for every gem you install? Because it solved this exact issue affecting another gem, not CocoaPods.

When i try this on Mac OS Catalina 10.15.5

rvm use 2.0.0                               
Using /Users/sam/.rvm/gems/ruby-2.0.0-p648
YAML safe loading is not available. Please upgrade psych to a version that supports safe loading (>= 2.0).

I get

Exception `LoadError' at /Users/sam/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/2.0.0/rubygems.rb:1087 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /Users/sam/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/2.0.0/rubygems.rb:1096 - cannot load such file -- rubygems/defaults/ruby
YAML safe loading is not available. Please upgrade psych to a version that supports safe loading (>= 2.0).
/Users/sam/.rvm/src/rubygems-3.0.8/lib/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- openssl (LoadError)
    from /Users/sam/.rvm/src/rubygems-3.0.8/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/sam/.rvm/src/rubygems-3.0.8/lib/rubygems/specification.rb:2481:in `to_ruby'
    from /Users/sam/.rvm/src/rubygems-3.0.8/lib/rubygems/commands/setup_command.rb:405:in `install_default_bundler_gem'
    from /Users/sam/.rvm/src/rubygems-3.0.8/lib/rubygems/commands/setup_command.rb:167:in `execute'
    from /Users/sam/.rvm/src/rubygems-3.0.8/lib/rubygems/command.rb:321:in `invoke_with_build_args'
    from /Users/sam/.rvm/src/rubygems-3.0.8/lib/rubygems/command_manager.rb:184:in `process_args'
    from /Users/sam/.rvm/src/rubygems-3.0.8/lib/rubygems/command_manager.rb:148:in `run'
    from /Users/sam/.rvm/src/rubygems-3.0.8/lib/rubygems/gem_runner.rb:59:in `run'
    from setup.rb:41:in `<main>'

Not really sure where I go from here as i've tried a few things:

$sudo gem update --system
YAML safe loading is not available. Please upgrade psych to a version that supports safe loading (>= 2.0).
ERROR:  Loading command: update (LoadError)
        cannot load such file -- openssl
ERROR:  While executing gem ... (NoMethodError)
    undefined method `invoke_with_build_args' for nil:NilClass

&

gem install -n /usr/local/bin cocoapods
YAML safe loading is not available. Please upgrade psych to a version that supports safe loading (>= 2.0).
ERROR:  Loading command: install (LoadError)
        cannot load such file -- openssl
ERROR:  While executing gem ... (NoMethodError)
    undefined method `invoke_with_build_args' for nil:NilClass
Was this page helpful?
0 / 5 - 0 ratings

Related issues

marzapower picture marzapower  路  3Comments

Curtis-Halbrook picture Curtis-Halbrook  路  3Comments

luhui picture luhui  路  3Comments

intelliot picture intelliot  路  3Comments

sonu5 picture sonu5  路  3Comments