1

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>'
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Usman Nisar
  • 3,031
  • 33
  • 41

3 Answers3

1

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

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Muraino
  • 554
  • 7
  • 18
  • tried these but didnt worked. i found a way. added as answer. – Usman Nisar Jun 21 '23 at 06:16
  • What is "shell profile"? File *[.profile](https://en.wikipedia.org/wiki/Bash_(Unix_shell)#Operating_system_issues_in_Bash_startup)*? File *[.bashrc](https://en.wikipedia.org/wiki/Bash_(Unix_shell)#Legacy-compatible_Bash_startup_example)*? File *[.zshrc](https://wiki.debian.org/Zsh#Configuration)*? Something else? – Peter Mortensen Jun 24 '23 at 10:38
0

Please try these steps:

brew install libyaml
brew reinstall ruby
gem uninstall psych
gem install psych
pod install
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Venus
  • 453
  • 2
  • 9
0

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Usman Nisar
  • 3,031
  • 33
  • 41