How to run CocoaPods on Apple Silicon (M1)



π How to run CocoaPods on Apple Silicon (M1)
Are you experiencing difficulties running CocoaPods on your new Apple Silicon-based M1 Mac? Don't worryβI've got you covered! In this guide, I'll walk you through common issues and provide easy solutions to help you get CocoaPods up and running smoothly. Let's dive in! πͺ
The Problem
One of our readers, who has a Flutter project, encountered an issue while trying to run it on iOS. Although the project runs without any problems on their Intel-based Mac, the installation of pods fails on their new M1 Mac. Here's the error message they provided:
LoadError - dlsym(0x7f8926035eb0, Init_ffi_c): symbol not found - /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle
...
The Solution
1. Update Rosetta 2
Since the reader mentioned that they tried running Terminal using Rosetta, we'll first make sure that Rosetta 2, the translation layer for running Intel-based apps on Apple Silicon, is updated. Here's what you need to do:
Open a Terminal window.
Enter the following command:
softwareupdate --install-rosetta
Wait for the update to finish.
2. Install Homebrew
Once Rosetta 2 is up to date, we'll need to install Homebrew, a popular package manager for macOS. Here's how you can do it:
Open a Terminal window.
Copy and paste the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Press Enter and follow the on-screen instructions to complete the installation.
3. Install CocoaPods
Now that we have Homebrew installed, let's proceed with installing CocoaPods:
Open a Terminal window.
Enter the following command:
arch -x86_64 sudo gem install cocoapods
If prompted, enter your password to proceed with the installation.
Wait for the installation to complete.
4. Update Your Project
To ensure that your project is ready to run on Apple Silicon, you need to update it by following these steps:
Open a Terminal window.
Navigate to your project's directory using the
cd
command.Run
arch -x86_64 pod install
to install the necessary pods.
5. Run Your Project π
With CocoaPods successfully installed and your project updated, it's time to run it:
Open your project in Xcode.
Build and run your project using the usual methods.
Enjoy the magic as your project runs smoothly on your Apple Silicon M1 Mac! π
The Next Step
Congratulations on successfully running CocoaPods on your Apple Silicon M1 Mac! If you found this guide helpful, feel free to share it with your friends who might also be facing the same issue.
But wait, there's more! If you encounter any other tech-related problems or have suggestions for future topics, comment down below or reach out to me on social media. I'm always here to help and bring you the latest tech hacks! π¨βπ»π‘
So go ahead, explore the power of CocoaPods on your new Mac and let your creativity shine through! Happy coding! ππ»
--Tech Guru