Cannot install Cocoapods on M1 Chip - ios

I am working on a Mac, M1 chip. I was working in React Native, when something happened with my system's configurations while trying to get the Android Build to work. No npm, npx, (any node commands really) worked, I couldn't do anything with my Pods, and essentially just everything was broken. I deleted and uninstalled everything to do with Node, Java, and Cocoapods but the issue I'm facing now is that I cannot install CocoaPods
I am following the directions from here and I am on my third try to just start a new React App. The Project will build, but I cannot install any pods and the whole app seems to not know that its supposed to be running off React as it won't let me use imported components.
So I have a plethora of issues in front of me, but the biggest is my inability to install CocoaPods.
I run...
brew install CocoaPods
and get the following return...
Warning: cocoapods 1.11.3 is already installed and up-to-date.
But upon running npx react-native init I get the following error...
error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
So I tried as I was instructed, and attempted to run...
sudo arch -x86_64 gem install ffi
Which gives me this...
make install failed, exit code 2
And since that fails, I cannot successfully run...
arch -x86_64 pod install
So it looks like my code is breaking before I can even type a single line. I've been trying to just create a new React Project for hours now... this seems very overly complicated

Update your ruby to recent version, for that you can use rbenv via homebrew. After that install cocoapods via gem install

There must have been some sort of corruption or only partially installed dependency. I ended up wiping my hard drive and restoring everything, it worked after that

Related

Facing issue while trying to init the pods on project

I hope you all are doing well.
I'm facing issue while trying to init the pod in the project. Cocoapods is already installed in the system. XCode Dev intstall is also there, In XCode in command line the xcode version is also selected. Don't know what I'm missing. I have MacOS BigSur.
If I run pod --version command on terminal it gives me version of 1.8.4.
I'm attaching the screenshot if someone has faced this issue.
I have the same issue. I solved it by following these steps:
First uninstall cocoapods with the command:
brew uninstall cocoapods
Reinstall Cocoapods:
sudo gem install cocoapods

Cocoapods error after updating to Android Studio 2021.1.1

I updated yesterday to the new Android Studio 2021.1.1
Now i get the following error, when i run my app on the ios emulator:
Warning: CocoaPods is installed but broken. Skipping pod install.
You appear to have CocoaPods installed but it is not working.
This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it.
This can usually be fixed by re-installing CocoaPods. For more info, see https://github.com/flutter/flutter/issues/14293.
To re-install:
sudo gem install cocoapods
CocoaPods not installed or not in valid state.
I tried everything for many hours.
At the end i go back to Android Studio 2020 previous version and it works perfect.
Any ideas?
Update:
This works for me:
uninstall cocoapods then
reinstalling cocoapods via homebrew.
Afterwards I did an "pod repo update"

unable to setup cocoapods. Cocoapods setup problem

I am trying to run my flutter app which is connected to Firebase, but when I try to run it on an iOS emulator, it shows these errors -
Warning: CocoaPods installed but not initialized. Skipping pod >install.
CocoaPods is used to retrieve the iOS and macOS platform side's >plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To initialize CocoaPods, run:
pod setup
once to finalize CocoaPods' installation.
So then I do "pod setup" but then it shows this error :
Cloning into 'master'...
remote: Enumerating objects: 14707, done.
remote: Counting objects: 100% (14707/14707), done.
remote: Compressing objects: 100% (14117/14117), done.
error: RPC failed; curl 18 transfer closed with outstanding read data
remaining
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
For me it was due to cocoapods version. You can use this in your terminal:
sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.7.5
pod setup
A workaround for this issue is here:
https://github.com/flutter/flutter/issues/41253
and also here:
https://flutter.dev/docs/get-started/install/macos#deploy-to-ios-devices
(I'm using macOS Catalina JIC)
After updating the Flutter version, faced the same issue.
Tried installing and uninstalling cocoapods and still the same issue.
Finally, the issue resolved for me.
If you are using Android studio
File -> Invalidate Caches -> Invalidate and Restart
This should be fixed now with flutter version v1.9.1+hotfix.5 and above.
Try uninstalling all existing installations of cocoapods:
sudo gem uninstall cocoapods
brew uninstall cocoapods
Then install the latest version of cocoapods:
sudo gem install cocoapods
pod setup
I can confirm that this is working with flutter 1.12.13+hotfix.9 (stable channel), cocoapods version 1.9.1, on macOS Catalina v10.15.4.
sudo gem install cocoapods -v 1.10.0 -n /usr/local/bin
I was battling with this issue for days on end. The issue, for me was only when I use my Mac with M1 Chip. Initially, i got this error when I tried to add a audio player package to my project. After a week of seaching I came across the this solutionenter link description here
The worked perfectly until i needed to use a geolocation package and the issue was back again. After days of trying different solutions, I finally found that the solution that worked for me. I reinstalled cocoapods using brew. Once done, I closed the terminal, closed android studio then ran the following command on terminal open /Applications/Android\ Studio.app. Pod now installs with no issues and my project launches on iOS.
Run the commands in your terminal (but not in the AndroidStudio for example):
sudo gem install cocoapods
pod setup
After, run:
flutter build ios
In flutter, I solve this issue by opening an android studio with terminal
use this line on your terminal
open /Applications/Android\ Studio.app

How to find if cocoaPods is installed in my mac

Can anyone help to find if cocoaPod is installed in my machine. I was trying to use Google Map in my application. So i was asked to install CocoaPods. Could any one help me explain me the purpose.
try to find pod version by running this in terminal
pod --version
If command not found then you didn't installed
To install cocoapods
sudo gem install cocoapods
Reference : https://cocoapods.org
Solution found: Initially the Cocoapods has to be installed using the command sudo gem install cocoapods (I had some problem with proxies so it dint work for me initially and i resolved it).
To find if Cocoapods is installed or not run cmd (pod --version). if theresult is (Not Found) Pods is not installed. Please check for the internet connection and their proxies, these things took me huge time.
Enter this line and see if you get error:
pod search realm

Cocoapods use_frameworks! issue

I found out that the way to resolve an issue, in a library i'm using, is to add use_frameworks! to the podfile. When i run pod install on the terminal, i get the following error:
[!] Invalid Podfile file: undefined method `use_frameworks!' for #.
Updating CocoaPods might fix the issue.
I'm using Cocoapods so i don't understand this issue. This tag is required for projects using swift, i'm using objective-c.
Looks to me like the second part of that error message:
Updating CocoaPods might fix the issue.
Is your issue. use_frameworks! was added in CocoaPods 0.36.0 which was just released recently.
Use pod --version to see what you're currently running. Assuming it's earlier than 0.36.0 you'll need to update it with
[sudo] gem install cocoapods
Which is just the same way you originally installed it.
I had the same issue when trying to run pod install on my mac.
So incase anyone encounters this issue what worked for me was changing the current ruby version with rvm.
On console, Use rvm list to see what versions you have installed:
So the version of ruby that was running on my mac was ruby-2.1.2.
I changed it with:
rvm use ruby-2.2.2
and ran pod install again and it worked.

Resources