cocoapods-keys: Error loading plugin on M1 mac

I’ve just gotten an M1 mac and trying to install everything and run a project that uses cocoapods keys. Its working if I run pod install with

arch -x86_64 pod install  

Other users on this thread: https://github.com/CocoaPods/CocoaPods/issues/9907 are reporting that if you update the pre-installed ruby version to at least 2.7.3, that it all works natively without the new for arch -x86_64. However when I do that, i get an error that ruby_inline/ruby-2.6.0 is not compatible.

 % pod install

---------------------------------------------
Error loading the plugin `cocoapods-keys-2.2.1`.

LoadError - dlopen(/Users/simonmcloughlin/.ruby_inline/ruby-2.6.0/Inline_OSXKeychain_5b2f8d1cd1bde9c4ff3fea49f09cd5c1.bundle, 0x0009): could not use '/Users/simonmcloughlin/.ruby_inline/ruby-2.6.0/Inline_OSXKeychain_5b2f8d1cd1bde9c4ff3fea49f09cd5c1.bundle' because it is not a compatible arch - /Users/simonmcloughlin/.ruby_inline/ruby-2.6.0/Inline_OSXKeychain_5b2f8d1cd1bde9c4ff3fea49f09cd5c1.bundle
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Gems/2.6.0/gems/RubyInline-3.12.5/lib/inline.rb:526:in `load'
/Library/Ruby/Gems/2.6.0/gems/RubyInline-3.12.5/lib/inline.rb:860:in `inline'
/Library/Ruby/Gems/2.6.0/gems/osx_keychain-1.0.2/lib/osx_keychain.rb:17:in `<class:OSXKeychain>'
/Library/Ruby/Gems/2.6.0/gems/osx_keychain-1.0.2/lib/osx_keychain.rb:6:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-keys-2.2.1/lib/keyring.rb:1:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-keys-2.2.1/lib/cocoapods_plugin.rb:1:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command/plugin_manager.rb:94:in `block in safe_activate_and_require'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command/plugin_manager.rb:94:in `each'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command/plugin_manager.rb:94:in `safe_activate_and_require'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command/plugin_manager.rb:31:in `block in load_plugins'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command/plugin_manager.rb:30:in `map'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command/plugin_manager.rb:30:in `load_plugins'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:326:in `block in run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:325:in `each'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:325:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
---------------------------------------------

I know nothing bout ruby or these tools. I’m assuming the inline version of ruby needs to be updated. Is this something you could do and cut a new release?

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 27 (1 by maintainers)

Most upvoted comments

Thanks to @xanderbuck and @jiayangmiao You don’t need to use arch command. Just install ruby 2.7.3

  1. install rbenv
brew install rbenv
echo 'eval "$(rbenv init -)"' >> ~/.zshrc
source ~/.zshrc
  1. install and switch to ruby 2.7.3
rbenv install 2.7.3
rbenv global 2.7.3
  1. make sure ruby -v was saying 2.7.3
  2. install cocoapods and cocoapods-keys, not through sudo, not with homebrew. gem install cocoapods cocoapods-keys
  3. install pod packages pod install

@midhetfatema94 Thank you very much for the reply!

Even though I made it work without doing what you did, I figured this might help someone else and here is the steps I taken. Nothing was run by rosetta, all just normal terminal in arm64

  1. install homebrew for rbenv, install 2.7.3, global 2.7.3, add rbenv to .zshrc, source, all that sort of stuff.
  2. make sure, make sure ruby -v was saying 2.7.3
  3. gem install cocoapods and cocoapods-keys, not through sudo, not with homebrew.
  4. pod install.

Hi, I’ve tried the solution described above that involves installing Ruby 2.7.3 with rbenv. When doing so, I get an error (see below). Is the solution above still valid for latest version of macOS? Should I consider dropping this plugin for development on M1 machines?

Error:

Downloading openssl-1.1.1q.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca
Installing openssl-1.1.1q...

BUILD FAILED (macOS 12.4 using ruby-build 20220710)

Inspect or clean up the working tree at /var/folders/6m/m0blyx852ysfp214tcvv3m_40000gn/T/ruby-build.20220714161205.75382.xdcE3o
Results logged to /var/folders/6m/m0blyx852ysfp214tcvv3m_40000gn/T/ruby-build.20220714161205.75382.log

Last 10 log lines:
clang  -Iinclude -arch x86_64 -O3 -Wall -D_REENTRANT -DZLIB -DZLIB_SHARED -DNDEBUG -I/Users/raffis/.rbenv/versions/2.7.3/include  -MMD -MF test/verify_extra_test.d.tmp -MT test/verify_extra_test.o -c -o test/verify_extra_test.o test/verify_extra_test.c
clang  -Iinclude -arch x86_64 -O3 -Wall -D_REENTRANT -DZLIB -DZLIB_SHARED -DNDEBUG -I/Users/raffis/.rbenv/versions/2.7.3/include  -MMD -MF test/versions.d.tmp -MT test/versions.o -c -o test/versions.o test/versions.c
test/v3ext.c:201:24: error: implicitly declaring library function 'memcmp' with type 'int (const void *, const void *, unsigned long)' [-Werror,-Wimplicit-function-declaration]
        if (!TEST_true(memcmp(ip1->data, ip2->data, ip1->length) <= 0))
                       ^
test/v3ext.c:201:24: note: include the header <string.h> or explicitly provide a declaration for 'memcmp'
1 error generated.

Current setup: Macbook Pro M1 Max macOS Monterey 12.4

I got it to work using Homebrew, rbenv and bundler all of it with arch commands. No Rosetta needed. I can share it if anyone would like it.

Your Podfile requires that the plugin cocoapods-keys be installed. Please install it and try installation again.

I have this error in M1 MAX & Monterey 12.6.1 & Xcode 14.1 & ruby version 3.1.2

I couldn’t solve this problem with all possible solutions and I did all steps in this Article and setup “gem install cocoapods-keys” and I have the same error, however I have ruby version 3.1.2 Can anyone solve this problem ?!!

Hi @jiayangmiao @simonmcl

The thing I actually did was open Terminal in Rosetta. (You can Click Cmd+option+i) in the Finder after selecting Terminal. This run the cocoapods-key plugin without any problems but did not make any changes. So I then cloned my repo on my Intel Macbook > installed the key > airdropped it to my m1! I realize that this solution is not optimal, I had to do what I had to do 🙈

Okay @simonmcl, I think try opening the terminal with Rosetta and it will work for you! It worked for me 😊

@xanderbuck These are the steps I used. I attached the file. I hope it helps someone else. 10/29/2021 HowToSetupCocoapodskeys.txt

If after doing that you have any problem with LLDB in Xcode, please run chsh -s /bin/bash. It did not happen to me, but to my colleague. Just in case.

Credits to https://github.com/igorcferreira

Update: 10/28/21

I tried every suggestion after many hours of troubleshooting and the only solution that worked for me was following @jiayangmiao instructions above. Make sure you install ruby 2.7.3. I thought I could get by with version 2.7.4 but that didn’t work. If you don’t have any experience with rbenv like me, I found this tutorial helpful here.