react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Issue while installing cocoa pods for macbookpro M1

Open abhishekambkr opened this issue 3 years ago • 11 comments

Description

Stack

   CocoaPods : 1.11.3
        Ruby : ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]
    RubyGems : 3.3.11
        Host : macOS 12.0.1 (21A559)
       Xcode : 13.3.1 (13E500a)
         Git : git version 2.32.0 (Apple Git-132)
Ruby lib dir : /opt/homebrew/Cellar/ruby/3.1.2/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

Plugins

cocoapods-deintegrate : 1.0.5
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.1
cocoapods-trunk       : 1.6.0
cocoapods-try         : 1.2.0

Podfile

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'
install! 'cocoapods', :deterministic_uuids => false

target 'RNP1' do
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'RNP1Tests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  use_flipper!()

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

Error

Errno::EACCES - Permission denied @ rb_sysopen - /Users/abhishekambekar/Library/Caches/CocoaPods/Pods/VERSION
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/downloader/cache.rb:171:in `initialize'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/downloader/cache.rb:171:in `open'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/downloader/cache.rb:171:in `open'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/downloader/cache.rb:171:in `ensure_matching_version'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/downloader/cache.rb:22:in `initialize'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/downloader.rb:41:in `new'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/downloader.rb:41:in `download'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer/pod_source_installer.rb:118:in `download_source'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer/pod_source_installer.rb:69:in `install!'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:563:in `install_source_of_pod'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:514:in `block (2 levels) in install_pod_sources'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/user_interface.rb:86:in `titled_section'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:513:in `block in install_pod_sources'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:496:in `each'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:496:in `install_pod_sources'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:255:in `block in download_dependencies'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/user_interface.rb:64:in `section'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:254:in `download_dependencies'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:162:in `install!'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/command/install.rb:52:in `run'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:52:in `run'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/bin/pod:55:in `<top (required)>'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/bin/pod:25:in `load'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/bin/pod:25:in `<main>'

Version

0.68.1

Output of npx react-native info

System: OS: macOS 12.0.1 CPU: (8) arm64 Apple M1 Memory: 181.67 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 18.0.0 - /opt/homebrew/bin/node Yarn: Not Found npm: 8.6.0 - /opt/homebrew/bin/npm Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: Not Found IDEs: Android Studio: Not Found Xcode: 13.3.1/13E500a - /usr/bin/xcodebuild Languages: Java: Not Found npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.68.1 => 0.68.1 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

after creating new react native project npx react-native init project-name, it shows this message ✔ Downloading template ✔ Copying template ✔ Processing template ✖ Installing CocoaPods dependencies (this may take a few minutes) ✖ Installing CocoaPods dependencies (this may take a few minutes) error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template. Please try again manually: "cd ./RNP1/ios && pod install".

But tried with pod install under ios folder, shows info mentioned in above description.

Kindly need help with this. Thank you 😊

Snack, code example, screenshot, or link to a repository

No response

abhishekambkr avatar May 07 '22 06:05 abhishekambkr

I have had also the same issue today "somehow" I fixed it, run inside the ios folder brew install CocoaPods then I got(probably you will get the same) another error built error(I don't remember exactly) then back to the root folder and run this code cd ios && pod install && cd ../ && react-native run-ios I have used this resource https://stackoverflow.com/questions/58546659/podfile-lock-missing-when-initial-react-native-run-ios

azeezipro avatar May 07 '22 19:05 azeezipro

I have had also the same issue today "somehow" I fixed it, run inside the ios folder brew install CocoaPods then I got(probably you will get the same) another error built error(I don't remember exactly) then back to the root folder and run this code cd ios && pod install && cd ../ && react-native run-ios I have used this resource https://stackoverflow.com/questions/58546659/podfile-lock-missing-when-initial-react-native-run-ios

Thank you @azeezipro, I have tried your solution, but issue remains same.

abhishekambkr avatar May 08 '22 16:05 abhishekambkr

Hey @abhishekambkr 👋

Have you also try running pod cache clean? (which should delete the /Users/abhishekambekar/Library/Caches/CocoaPods directory, otherwise, I would also delete it manually)

fortmarek avatar May 09 '22 08:05 fortmarek

Hey @abhishekambkr 👋

Have you also try running pod cache clean? (which should delete the /Users/abhishekambekar/Library/Caches/CocoaPods directory, otherwise, I would also delete it manually)

@fortmarek sure I will check with this one, thank you 😊

abhishekambkr avatar May 09 '22 15:05 abhishekambkr

@abhishekambkr have you solved the issue?

cipolleschi avatar May 17 '22 14:05 cipolleschi

@abhishekambkr @cipolleschi can you try this in M1?

sudo arch -x86_64 gem install ffi
arch -x86_64 pod install

These commands install the ffi package, to load dynamically-linked libraries and let you run the pod install properly, and runs pod install with the proper architecture.

HarshitMadhav avatar May 25 '22 04:05 HarshitMadhav

When I run npx react-native-info I can see my system is fetching cocoapods from /usr/local/bin/pod while your system is fetching cocoapods from /opt/homebrew/bin/pod so I would suggest you uninstall cocoapods and reinstall using sudo arch -x86_64 gem install cocapods or use rosseta

Also I faced this issue on a M1 based mac book when I ran pod install normally it worked without any error but I faced this issue #33793 to resolve that I ran arch -x86_64 pod install

jaydave1412 avatar May 25 '22 11:05 jaydave1412

I used brew instead and it works fine

brew install cocopoads

BalogunofAfrica avatar Jul 22 '22 19:07 BalogunofAfrica

I think we can close this now as I believe the version supplied by brew of cocoapods is M1 compatible

cortinico avatar Jul 29 '22 16:07 cortinico

Hey @abhishekambkr, try this I faced this issue on an M1 based mac book macOS big sure 11.6.8,

  1. brew install cocopoads
  2. ruby 2.6.8p205 (2021-07-07 revision 67951) [x86_64-darwin20]
  3. then in project cd ios run 2 commands as, sudo arch -x86_64 gem install ffi arch -x86_64 pod install
  4. then you need to remove libswiftWebKit.tbd from build phases -> Link Library With Libraries

MayuriPapat avatar Aug 12 '22 17:08 MayuriPapat



brew install cocoapods or sudo gem install cocoapods
sudo arch -x86_64 gem install ffi
cd ./AwesomeApp/ios && pod install

i have experienced the same issue with m1 & latest cocoapods (1.11.3)

j0eii avatar Oct 19 '22 16:10 j0eii

This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days.

github-actions[bot] avatar Jan 23 '23 02:01 github-actions[bot]