I was updating my app, I ran the ‘ionic build’ command, and it worked. But when I ran the ‘npx cap sync ios’ command, I got the following error. What could be the issue? How to fix it?
I believe it might be related to a file name that I changed in Xcode options, and when I run “npx cap sync ios” Capacitor is unable to locate it. However, I’m unsure where to check. Does anyone have any suggestions?
I am using: ionic 5 capacitor 5.0.2, Xcode 14.3
✔ Copying web assets from www to ios/App/App/public in 424.41ms
✔ Creating capacitor.config.json in ios/App/App in 1.99ms
✔ copy ios in 466.29ms
✔ Updating iOS plugins in 5.60ms
[info] Found 4 Capacitor plugins for iOS:
@capacitor/app@5.0.2
@capacitor/haptics@5.0.2
@capacitor/keyboard@5.0.2
@capacitor/status-bar@5.0.2
✖ Updating iOS native dependencies with pod install - failed!
✖ update ios - failed!
[error] Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
Analyzing dependencies
[!] Unable to find a target named `App` in project `Dental Age.xcodeproj`, did find `Dental Age`.
Are you on an Apple Silicon computer?
If so, how did you install CocoaPods?
There are some problems with CocoaPods and Apple Silicon computers, that’s why we recommend installing CocoaPods using homebrew instead of doing gem install cocoapods
, as installing using homebrew fixes some issues
Yes, it is an Apple Silicon M1.
This computer is a “mirror” of a non-silicon Mac. However, I believe that should not be a problem as I have already made other apps and updates without any issues.
And how did you install CocoaPods?
As I said, CocoaPods have problems on ffi library when installed with gem install command on Apple Silicon macs.
Even if it was working before, a CocoaPods update or ruby update, or ffi update could have caused that ffi stoped working.
I installed it a long time ago. I believe it was with gem, but I am not sure. Is there a way to check how the installation was done?
So I need to reinstall it using with homebrew.
You can run which pod
, if it returns /opt/homebrew/bin/pod
then it was installed using homebrew, if the path doesn’t include homebrew
then you probably installed it with gem.
Before reinstalling it with homebrew, fully uninstall it ios - How to fully uninstall the Cocoapods from the Mac Machine? - Super User
Ok, I will attempt and post it here. Many thanks.
I thought I would share what I have had success with. The Capacitor docs say to use Rosetta to install CocoaPods and ffi but I was able to get it to work without needing to.
Here are the commands that I ran (note I am using --user-install
as I don’t have admin access on the Mac, using a Mac in the cloud).
# Add some environment variables to your bash profile settings
export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/bin:$PATH
# Run the following commands
gem install cocoapods --user-install
gem install --user-install ffi -- --enable-libffi-alloc
The command to install ffi
was found here.
After running pod, it returned:
Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
Usage:
$ pod COMMAND
CocoaPods, the Cocoa library package manager.
Commands:
+ cache Manipulate the CocoaPods cache
+ deintegrate Deintegrate CocoaPods from your project
+ env Display pod environment
+ init Generate a Podfile for the current directory
+ install Install project dependencies according to versions from a
Podfile.lock
+ ipc Inter-process communication
+ lib Develop pods
+ list List pods
+ outdated Show outdated project dependencies
+ plugins Show available CocoaPods plugins
+ repo Manage spec-repositories
+ search Search for pods
+ setup Setup the CocoaPods environment
+ spec Manage pod specs
+ trunk Interact with the CocoaPods API (e.g. publishing new specs)
+ try Try a Pod!
+ update Update outdated project dependencies and create new Podfile.lock
Options:
--allow-root Allows CocoaPods to run as root
--silent Show nothing
--version Show the version of the tool
--verbose Show more debugging information
--no-ansi Show output without ANSI codes
--help Show help banner of specified command
Thank you to share.
I’m finishing running some tests (other apps) so I can handle this error and I will post the result here.
Despite the ffi library errors, I am still able to run and update my apps (Android e iOS). Therefore, for the time being, I haven’t made any changes to CocoaPods.