macosnativescriptangular2-nativescriptnativescript-angularnativescript-vue

Installing NativeScript environment, issue with cocoapods on M1 mac in 2023


I am having issues with installing NativeScript. My machine uses a M1 chip, I'm reading M1 and cocoapods have issues. Other SO answers are not fixing the issue, and some are outdated. Hoping we can get an updated answer.

I followed the mac instructions on this guide:

sudo ns doctor ios returns all checkmarks up until

✖ WARNING: CocoaPods is not installed or is not configured properly. 
 You will not be able to build your projects for iOS if they contain plugin with CocoaPod file.

How can I properly configure cocoapods for M1 chip?


I have uninstalled and reinstalled cocoapods using gem

sudo gem uninstall cocoapods for each cocoapod gem in "gem list cocoapods" sudo gem uninstall cocoapods-NAME

and reinstalled sudo gem install cocoapods

my zshrc for gem installation export PATH="/usr/local/lib/ruby/gems/2.7.0/bin:$PATH"

Result is the same error.

I have also tried using home brew to install and uninstall cocoapods brew install --cask cocoapods/brew install cocoapods and brew uninstall cocoapods

my zshrc for brew installation export PATH="/opt/homebrew/lib/ruby/gems/2.7.0/bin:$PATH"

Result is the same error

While installed, both options return version 1.12.1 when calling "pod --version"

Another thing I have been seeing in other SO posts is to try arch sudo arch -x86_64 gem install cocoapods this returns arch: posix_spawnp: gem: Bad CPU type in executable

Opening the terminal using rosetta does not fix this issue for me.

This command does work however: arch -arm64 brew install cocoapods pod --version works properly (1.12.1)

Result is the same error


I have uninstalled and reinstalled many times in different ways, I have followed the accepted answer of countless SO questions, and nothing is correctly configuring cocoapods. The other needed gem "xcodeproj" works just fine.

Thank you.


Solution

  • Found the answer.

    Denkan's answer on this thread fixed the issues with cocoapods. https://github.com/NativeScript/nativescript-cli/issues/5447

    I needed to manually recreate the tns doctor steps.