Pod install is not working. It fails with some Ruby-related issue

496 Views Asked by At

I am trying this in terminal:

pod install

Response:

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/yaml.rb:3: warning: It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/psych-5.1.0/lib/psych.bundle, 0x0009): tried: '/Library/Ruby/Gems/2.6.0/gems/psych-5.1.0/lib/psych.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Ruby/Gems/2.6.0/gems/psych-5.1.0/lib/psych.bundle' (no such file), '/Library/Ruby/Gems/2.6.0/gems/psych-5.1.0/lib/psych.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')) - /Library/Ruby/Gems/2.6.0/gems/psych-5.1.0/lib/psych.bundle (LoadError)
        from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
        from /Library/Ruby/Gems/2.6.0/gems/psych-5.1.0/lib/psych.rb:13:in `<top (required)>'
        from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
        from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/yaml.rb:4:in `<top (required)>'
        from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
        from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
        from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/sources_manager.rb:6:in `<top (required)>'
        from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
        from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
        from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/core_overrides.rb:1:in `<top (required)>'
        from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
        from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
        from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods.rb:77:in `<module:Pod>'
        from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods.rb:17:in `<top (required)>'
        from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
        from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
        from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/bin/pod:36:in `<top (required)>'
        from /usr/local/bin/pod:23:in `load'
        from /usr/local/bin/pod:23:in `<main>'
3

There are 3 best solutions below

2
Yakubu On

The error message is a compatibility issue between the Ruby installation and YAML dependencies. Try these steps:

  • brew install libyaml

  • brew install rbenv

  • Set up RBEnv in your shell by adding the following to your shell profile

    if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
    
  • Install the required Ruby version, rbenv install 2.6.8

  • Set the installed Ruby version as the global default. rbenv global 2.6.8

  • install bundler by running. gem install bundler

  • update your CocoaPods installation gem install cocoapods

  • Then run pod install again

0
Venus On

Please try these steps:

brew install libyaml
brew reinstall ruby
gem uninstall psych
gem install psych
pod install
0
Usman Nisar On

This approach worked with me on a MacBook Pro M1 system.

In Terminal:

curl -L https://get.rvm.io | bash -s stable

source ~/.rvm/scripts/rvm

rvm install ruby-2.7.2

sudo gem install cocoapods

Then restart the terminal:

pod init

It's working fine.