How to address problems with Ruby, cocoapods and react-native CLI on M1 MacBooks

Wisam Halawi
3 min readMar 8, 2021

You may have come across issues with installing podfile, using Homebrew, or using anything that might require Ruby on your M1 Mac or MacBook.

I’ve personally come across this issue when using react-native init to initialise a React Native application. It throws an error when trying to install the iOS dependencies because cocoapod needs Ruby to work properly.

Ruby doesn’t work properly from the get-go due to a problem with the universal binary that Apple is configured Ruby to use in Big Sur to work with the ARM architecture and it still recognising the host CPU as x86_64. Each binary needs a separate rbconfig.rb configuration file which is not supported by the rbconfig module and since Apple are intending to deprecate the Ruby binary there’s no real solution to this. Here’s a work around.

First things first: head to the Apple developer download page to download and install the latest build of Xcode and Command Line Tools.

Once they’re both installed, open a terminal window and install Rosetta2 with this command.

/usr/sbin/softwareupdate —install-rosetta —agree-to-license

Now we need to install a version of Homebrew that will work with ARM. Run this next.

--

--

Wisam Halawi
Wisam Halawi

No responses yet