I am using Mac M1. My React native project has been built using Typescript, Firebase. When I try running pod install inside ios folder, I am getting this below error.
`require': dlopen(/Users/kalidass/.rvm/rubies/ruby-
2.7.4/lib/ruby/gems/2.7.0/gems/stringio-3.0.5/lib/stringio.bundle, 0x0009): tried:
'/Users/kalidass/.rvm/rubies/ruby-2.7.4/lib/ruby/gems/2.7.0/gems/stringio-
3.0.5/lib/stringio.bundle' (mach-o file, but is an incompatible architecture (have
(x86_64), need (arm64e))) - /Users/kalidass/.rvm/rubies/ruby-
2.7.4/lib/ruby/gems/2.7.0/gems/stringio-3.0.5/lib/stringio.bundle (LoadError)
Later I have tried creating a blank React native project, I have noticed the below error.
churby: Comman not found
✖ Installing Bundler
error zsh:1: command not found: chruby
WARN: Unresolved or ambiguous specs during
Gem::Specification.reset:
ipaddr (>= 0)
Available/installed versions of this gem:
- 1.2.2
WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'
Please report a bug if this causes problems.
error Error: Looks like your iOS environment is not properly
set. Please go to
https://reactnative.dev/docs/next/environment-setup and follow
the React Native CLI QuickStart guide for macOS and iOS.
Tried almost whatever possible commands.
Opened my terminal using Rosetta
Followed the commands to install pods for M1 chip
No luck. Any help is appreciated.
node - 16.16.0
npm - 8.11.0
java - 11.0.5
react-native - 8.0.5
ruby - 2.7.4
2
Answers
Unfortunately, on Apple silicon there is a Ruby issue and I do not know why.
I use RVM for handling Ruby issues. I strongly suggest you to use RVM instead of other tools.
You can use
rvm use 2.7.4
and it probably will fix your pod install problemI had a lot of different issues trying to install ruby on a Mac M1 but now I’m okay with chruby + ruby-install.
Take a look to this guide:
https://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/
For Mac M1 care about the good command to install ruby 2.7.4.
It should be: ruby-install 2.7.4 –enable-shared
Also don’t run your terminal under Rosetta
Now next time you will upgrade RN, you will just have to refer to the version of the .ruby-version file to install it with ruby-install then check it with ruby –version in your project folder. And all will be okay 🙂