6 June 2024 Leave a comment Tech-Help
Transitioning to an Apple Silicon (M1) Mac can introduce several challenges, especially when running development tools originally designed for Intel-based systems. One common issue developers face is running CocoaPods on an M1 Mac, particularly when working on Flutter projects targeting iOS. This guide provides a step-by-step solution to help you successfully install and run CocoaPods on your Apple Silicon device.
Solution Overview
Follow these steps to install CocoaPods on your M1 Mac:
- Uninstall the local CocoaPods gem:
- Reinstall CocoaPods via Homebrew:
sudo gem uninstall cocoapods
brew install cocoapods
Additional Steps for Troubleshooting
If you encounter issues with the above steps, consider the following troubleshooting tips:
- Install ffi gem: If you see an error related to ffi, you can install the ffi gem using the following command:
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install
alias pod='arch -x86_64 pod'
Alternative Ruby Installation
For a more permanent solution, consider installing a version of Ruby specifically built for ARM64. Here’s how to do it using Homebrew:
- Install Ruby:
- Add Ruby and gems binaries to your PATH:
- Source your shell configuration:
- Install CocoaPods:
- Verify Ruby and CocoaPods installation:
brew install ruby
export PATH=/opt/homebrew/opt/ruby/bin:/opt/homebrew/lib/ruby/gems/3.0.0/bin:$PATH
source ~/.zshrc
sudo gem install cocoapods
which ruby
which pod
Conclusion
By following these steps, you should be able to run CocoaPods on your M1 Mac without issues. Whether you choose to use Homebrew for a more streamlined installation or manually configure your environment, these solutions will help you get your development workflow back on track.
Streamline Your Mobile Development with Repeato
As a mobile developer, ensuring your applications run smoothly across different environments is crucial. Repeato, our No-code test automation tool for iOS and Android, can help you achieve this effortlessly. Repeato allows you to create, run, and maintain automated tests for your apps quickly and efficiently, leveraging computer vision and AI. This enables you to focus on developing great features while leaving the testing process to Repeato. Additionally, it allows non-technical colleagues or QAs to participate in the testing process, ensuring a comprehensive and collaborative approach to quality assurance.
Learn more about Repeato and how it can enhance your development process by visiting our documentation and blog.