Search code examples
iosrubyreact-nativecocoapodsglog

Pod installation fails at glog with React Native and Mac M2


My problem

I bought my MacBook Pro M2 two weeks ago, and since then, I've been unable to install the pods in my React Native app. (I've been working with React Native for over a year without issues on an M1).

The error starts when I run the command cd ios && pod install, I always get an error when it reaches the glog pod.

My goal

I want to run npm run ios (like I always did with my previous mac) and install/run the app in the iOS simulator.

What I've tried

During the last 2-3 weeks, I've been installing & re-installing everything from Node, Ruby, Bundler, Xcode, Command Line Tools... I've tried everything from the github and stack overflow issues, but none of the worked for me and I'm really desperate that nothing seems to work.

Command that throws error

cd ios && pod install

Error (summarized)

-> Installing boost (1.76.0)
  > Copying boost from
  `/Users/jvegax/Library/Caches/CocoaPods/Pods/External/boost/909665deed38b6f25051fac8c534aa3c-57d28` to `Pods/boost`

-> Installing fmt (6.2.1)
  > Copying fmt from `/Users/jvegax/Library/Caches/CocoaPods/Pods/Release/fmt/6.2.1-ff9d5` to `Pods/fmt`

-> Installing glog (0.3.5)
 > Git download
 > Git download
     $ /opt/homebrew/bin/git clone https://github.com/google/glog.git
     /var/folders/tn/v1qdr5nj7g75l5fj9qzx9px80000gn/T/d20230702-30759-hefom7 --template= --single-branch --depth 1
     --branch v0.3.5
Cloning into '/var/folders/tn/v1qdr5nj7g75l5fj9qzx9px80000gn/T/d20230702-30759-hefom7'...
Note: switching to 'a6a166db069520dbbd653c97c2e5b12e08a8bb26'.

You are in a 'detached HEAD' state. You can look around, make experimental changes and commits, and you can discard any commits you make in this state without impacting any branch by performing another checkout.

If you want to create a new branch to retain commits you create, you can do so (now or later) with the checkout command using -c. For example:

   git switch -c <new-branch-name>

Or undo the operation with:

   git switch -

Turn off this advice by setting the advice.detachedHead configuration variable to false.


[!] Error installing glog
  CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only performed in repo update

React Native Info

System:
  OS: macOS 13.4.1
  CPU: (8) arm64 Apple M2
  Memory: 95.67 MB / 8.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.16.1
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 9.6.7
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2023.06.26.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.12.1
    path: /Users/jvegax/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 22.4
      - iOS 16.4
      - macOS 13.3
      - tvOS 16.4
      - watchOS 9.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.2 AI-222.4459.24.2221.10121639
  Xcode:
    version: 14.3.1/14E300c
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.19
    path: /usr/bin/javac
  Ruby:
    version: 2.7.6
    path: /Users/jvegax/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

~/.zprofile

eval "$(/opt/homebrew/bin/brew shellenv)"

export ANDROID_SDK_ROOT="/Users/jvegax/Library/Android/sdk"
export ANDROID_PLATFORM_TOOLS="$ANDROID_SDK_ROOT/platform-tools"
export ANDROID_TOOLS="$ANDROID_SDK_ROOT/tools"
export ANDROID_TOOLS_BIN="$ANDROID_TOOLS/bin"
export ANDROID_BUILD_TOOLS="$ANDROID_SDK_ROOT/build-tools/33.0.0" #edit according to sdk version

path=(
  $ANDROID_TOOLS
  $ANDROID_SDK_ROOT
  $ANDROID_TOOLS_BIN
  $ANDROID_PLATFORM_TOOLS
  $ANDROID_BUILD_TOOLS
  $path
)

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
eval "$(rbenv init -)"

~/.zshrc

eval "$(/opt/homebrew/bin/brew shellenv)"

# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"

ZSH_THEME="gozilla"

source $ZSH/oh-my-zsh.sh

export ANDROID_SDK_ROOT="/Users/jvegax/Library/Android/sdk"
export ANDROID_PLATFORM_TOOLS="$ANDROID_SDK_ROOT/platform-tools"
export ANDROID_TOOLS="$ANDROID_SDK_ROOT/tools"
export ANDROID_TOOLS_BIN="$ANDROID_TOOLS/bin"
export ANDROID_BUILD_TOOLS="$ANDROID_SDK_ROOT/build-tools/33.0.0" #edit according to sdk version

path=(
  $ANDROID_TOOLS
  $ANDROID_SDK_ROOT
  $ANDROID_TOOLS_BIN
  $ANDROID_PLATFORM_TOOLS
  $ANDROID_BUILD_TOOLS
  $path
)

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
eval "$(rbenv init -)"

Solution

  • Perhaps you have already tried this but have you tried deleting podfile.lock to delete old pods and and reinstall everything doing

    pod deintegrate pod setup pod install