How to Run CocoaPods on Apple Silicon (M1)?
Table of Contents
CocoaPods is a vital application-level dependency manager used for the objective-C and the swift and in the other languages that run on the objective-c run time like the ruby motion. It provides a standard format to manage the external libraries.
CocoaPods primarily depend upon the source-based distributions of the third-party code and the automatic integration with the Xcode projects. It also runs from the command line. CocoaPods tends to install the dependencies for an application by the specification of the dependencies instead of copying the source files manually.
But often, one can face the problem of successfully installing the CocoaPods on the Apple Silicon M1. However, there is a solution for this problem too; Flutter Agency a leading Flutter mobile application development company that provides the solution for this problem.
You can take the help of the flutter agency to solve the problem of running and installing the CocoaPods on Apple Silicon M1. But in this article, we will also glance at some of the solutions suggested by the flutter agency to solve this issue.
Solution to run CocoaPods on Apple Silicon M1
The mobile app developer can face serious issues if they cannot compile the Xcode project after installing the CocoaPods. And while compiling the Xcode project they might end up seeing something like this:
LoadError — dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle, 0x0009): missing compatible arch in /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle — /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require’ /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require’ /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/lib/ffi.rb:6:in
If you are also an IoS developer and work with the CocoaPods on Xcode and you are facing similar issues. Then you can try any of the below-mentioned solutions to fix this problem.
- In the first step, you must look for the terminal in the finder.
- After this, you need to right-click on the terminal and then click on “get info”, and after this, you are required to check open using Rosetta, which you can easily find under the general menu.
- After the above step, you should open the terminal, and then you need to type sudo gem install ffi
- Then you are required to install the CocoaPods with the sudo gem install cocoapods
- Once you have successfully installed the CocoaPods, you need to uncheck the box appearing on your screen with the Open using Rosetta, and it will again start working.
- Then you can visit your project directory and work again.
The above-discussed step is suggested by the flutter agency, Flutter Agency, a leading Flutter mobile application development company. You can trust the steps mentioned above, follow them, and seamlessly solve this tedious task.
However, if this solution is not working for you, there are more solutions that the flutter agency suggests, these are as follows:
- In the first step, you must duplicate the terminal application; you can do it in the utility folder.
- Then you are required to right-click on the application and then select “get info”.
- After the step mentioned above, you need to rename the other version of the application with a suitable name according to you.
- Then you need to check the option displaying on your screen “ Open with Rosetta.”
- After the above step, you need to install the CocoaPods with the command sudo gem install CocoaPods.
- Then you are required to type the command line gem install ffi to fix the problem of the ffi bundle.
- Thus, you can successfully do the pod install without facing any further issues.
You can also refer this link to install CocoaPods.
Video Source: David Razmadze
Another solution suggested by the flutter agency to run CocoaPods on apple silicon (M1) is as follows:
- You need to install your version of the ruby along with homebrew, or rbenv or RVM.
- After the above step, you need to add it and then gems binaries to the path and ensure that the new version is used with ruby that should be in opt with the homebrew or opt with ruby/bin//ruby rather than using the usr//bin/ruby if it is installed along with homebrew.
- Then you need to install the CocoaPods with the sudo gem install Cocoapods. While performing this step, you need to ensure that the ethon is at its latest version that is 0.13.0
Thus, above, we have mentioned three different solutions to run the Cocoapods on the Apple Silicon M1. These solutions are suggested by Flutter Agency, a leading Flutter mobile application development company. You need to carefully follow the above-discussed steps so run the CocoaPods on the M1 effectively and seamlessly.