After updating to macOS Big Sur beta you might encounter issues when using Ruby Bundler to manage Ruby gems in your project - in our case to install CocoaPods and Fastlane for iOS development.
Ignoring json-2.2.0 because its extensions are not built. Try: gem pristine json --version 2.2.0
...
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
...
fatal error: 'ruby/config.h' file not found
- Make sure you have the latest Xcode and Command line tools installed in a correct directory
softwareupdate --all --install --force
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
- Install Rbenv to manage Ruby versions
- Why Rbenv is a better choice than RVM: https://dev.to/krtb/why-and-how-i-replaced-rvm-with-rbenv-23ad
- Full Rbenv installation guide: https://github.com/rbenv/rbenv#installation
brew install rbenv ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.zshrc
source ~/.zshrc
- Install Ruby 2.7.2
rbenv install 2.7.2
rbenv global 2.7.2
ruby -v
should now returnruby 2.7.2 ...
- Reinstall CocoaPods and Fastlane
gem uninstall cocoapods
rm /usr/local/bin/pod
gem uninstall fastlane
rm /usr/local/bin/fastlane
gem install cocoapods
- no sudogem install fastlane
- no sudowhich fastlane
andwhich pod
should now return/Users/username/.rbenv/shims/...
- Profit