How to run CocoaPods on Apple Silicon (M1)

Cover Image for How to run CocoaPods on Apple Silicon (M1)
Matheus Mello
Matheus Mello
published a few days ago. updated a few hours ago

πŸš€ 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:

  1. Open a Terminal window.

  2. Enter the following command: softwareupdate --install-rosetta

  3. 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:

  1. Open a Terminal window.

  2. Copy and paste the following command: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

  3. 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:

  1. Open a Terminal window.

  2. Enter the following command: arch -x86_64 sudo gem install cocoapods

  3. If prompted, enter your password to proceed with the installation.

  4. 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:

  1. Open a Terminal window.

  2. Navigate to your project's directory using the cd command.

  3. 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:

  1. Open your project in Xcode.

  2. Build and run your project using the usual methods.

  3. 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


More Stories

Cover Image for How can I echo a newline in a batch file?

How can I echo a newline in a batch file?

updated a few hours ago
batch-filenewlinewindows

πŸ”₯ πŸ’» πŸ†’ Title: "Getting a Fresh Start: How to Echo a Newline in a Batch File" Introduction: Hey there, tech enthusiasts! Have you ever found yourself in a sticky situation with your batch file output? We've got your back! In this exciting blog post, we

Matheus Mello
Matheus Mello
Cover Image for How do I run Redis on Windows?

How do I run Redis on Windows?

updated a few hours ago
rediswindows

# Running Redis on Windows: Easy Solutions for Redis Enthusiasts! πŸš€ Redis is a powerful and popular in-memory data structure store that offers blazing-fast performance and versatility. However, if you're a Windows user, you might have stumbled upon the c

Matheus Mello
Matheus Mello
Cover Image for Best way to strip punctuation from a string

Best way to strip punctuation from a string

updated a few hours ago
punctuationpythonstring

# The Art of Stripping Punctuation: Simplifying Your Strings πŸ’₯βœ‚οΈ Are you tired of dealing with pesky punctuation marks that cause chaos in your strings? Have no fear, for we have a solution that will strip those buggers away and leave your texts clean an

Matheus Mello
Matheus Mello
Cover Image for Purge or recreate a Ruby on Rails database

Purge or recreate a Ruby on Rails database

updated a few hours ago
rakeruby-on-railsruby-on-rails-3

# Purge or Recreate a Ruby on Rails Database: A Simple Guide πŸš€ So, you have a Ruby on Rails database that's full of data, and you're now considering deleting everything and starting from scratch. Should you purge the database or recreate it? πŸ€” Well, my

Matheus Mello
Matheus Mello