04/10/2023, 4:53 AM
Hey guys I was following the official Documentation to setup environment for developing a KMM project but I have ran into the following problem: While running kdoctor
[✖] Cocoapods
✖ System ruby is currently used
CocoaPods is not compatible with system ruby installation on Apple M1 computers.
Please install ruby via Homebrew, rvm, rbenv or other tool and make it default
Detailed information: <>
✖ cocoapods not found
Get cocoapods from <>
✖ KDoctor has diagnosed one or more problems while checking your environment.
Please check the output for problem description and possible solutions.
I followed these instructions from the StackOverflow link mentioned For Homebrew: • Execute
brew install ruby
• Add
export PATH=/opt/homebrew/opt/ruby/bin:/opt/homebrew/lib/ruby/gems/3.0.0/bin:$PATH
to your
(you can find your Homebrew installation directory with
$(brew --prefix)
if needed) • Execute
source ~/.zshrc
or restart your shell • Make sure you are using the correct
binary by executing
which ruby
(should be
$(brew --prefix)/opt/ruby/bin/ruby
) • Install CocoaPods with
sudo gem install cocoapods
• Make sure you are using the correct
binary by executing
which pod
(should be
$(brew --prefix)/lib/ruby/gems/3.0.0/bin/pod
) • Make sure
is version 0.13.0 or more with
gem info ethon
, otherwise run
sudo gem install ethon
• Run
pod install
Before adding the path to my .zshrc file, executing
which ruby
returned /usr/bin/ruby and
(brew --prefix)
returned /usr/local after that I followed the second step This is the path I added to my .zshrc file
export PATH=/usr/local/opt/homebrew/usr/local/opt/ruby/bin:/usr/local/opt/homebrew/lib/ruby/gems/3.0.0/bin:$PATH
but as I'm running
which ruby
in my terminal again it's still showing /usr/bin/ruby but according to the solution it should be (brew --prefix)/opt/ruby/bin/ruby I have made sure that my .zshrc file is getting updated. I guess this is the reason of the failure but I may be wrong any tips on resolving this? Thanks Also I came to know about this channel from the official documentation itself
You will probably need rbenv to select which ruby installation


04/10/2023, 6:29 AM
Thanks, I tried running a KMM project without resolving the cocoapods issue and it is running fine as I used regular framework for dependency management. I'll still try resolving the issue though thanks a lot


04/10/2023, 9:10 AM
Install cocoapods using homebrew, and this will install latest ruby as its dependency. Then overwrite the System ruby in-use by linking the ruby version added by cocoapods, check with kdoctor if all is well $ brew install cocoapods $ brew link ruby --overwrite $ kdoctor -v

Konstantin Tskhovrebov

04/10/2023, 9:40 AM
If these steps help you, we will add it to our doc! @Raghav


04/10/2023, 9:53 AM
thanks @Konstantin Tskhovrebov, will try them and revert back here if they work.
I tried installing ruby 2.7.0 as per the StackOverflow thread but the installation failed with this error @Pablichjenkov


04/10/2023, 1:31 PM
Ahh I see man, not sure what could possibly be wrong. Not a ruby expert by far. Try the above solution, looks promising.

Sam Stone

04/10/2023, 9:28 PM
Was getting the exact same error yesterday, almost spent 24 hours straight fixing it. I had to: • uninstall homebrew, because when I installed it months ago it did not support the M1 (always had to do arch -arm64 brew install). • Uninstalled anything I had done until that point (cocoapods gem, rbenv, ruby-build, manual ruby install, etc).
open /opt/homebrew
and delete all of the files in that folder • Install homebrew (
/bin/bash -c "$(curl -fsSL <>)"
). • Set homebrew path with
(echo; echo 'eval "$(/usr/local/bin/brew shellenv)"') >> /Users/my_name/.zprofile
eval "$(/usr/local/bin/brew shellenv)"
• Edit .zshprofile: replace old path to homebrew with
so it looked like this (in my .zshprofile, I also set PATH for my Python install and “export PATH”, not sure if that makes a difference) :
eval "$(/usr/local/Homebrew/bin/brew shellenv)"
eval "$(/usr/local/Homebrew/bin/brew shellenv)"
eval "$(/usr/local/bin/brew shellenv)"
eval "$(/usr/local/bin/brew shellenv)"
• Update macOS and xcode command line tools (was behind 2 updates) •
brew install cocoapods
cd kmm_project/ios
pod install
Worked like a charm!