'cordova build ios' is painfully slow on mac

193 Views Asked by At

Cordova CLI build takes 5+ minutes to complete on iMac and takes about 10 seconds to complete on my Windows computer. Then to deploy app to device or simulator, on Xcode it takes about 2.5 minutes and on Windows it takes like 3 seconds.

What is happening on iMac/Xcode that is taking sooooo long to compile?

Mac Mini (2018): 3.6Ghz, Quad-Core Intel i3, 64Gb DDR4 memory,  
MacOS: Ventura 13.2.1
Cordova CLI: 11.1.0
Cordova-IOS: 6.2.0
Compile Time: 5.5 minutes (avg)
Deploy time: 2.5 - 3 minutes
CLI Compile: ionic cordova build ios  OR cordova build ios

HP EliteDesk 800 G5 Mini, Intel Core i7-9700T 2.00Ghz, 64Gb DDR4 memory
Windows 10
Cordova CLI: 11.1.0
Cordova-Android: 11.0.0
Compile time: 10 - 15 seconds (avg)
Deploy time: 3 seconds
CLI Compile command: ionic cordova build android OR cordova build android

I had this same iMac running xcode 12 and builds took about 30 seconds. Then on Xcode 13 it increased to about 2 minutes and then on Xcode 14 its up over 5 1/2 minutes. And thats just the CLI compile part...deploying the app via Xcode to connected devices is easily another 2 1/2 minutes...were talking 8+ minutes to get the app compiled and deployed. Once it starts to launch on the device or the simulator the app works perfect and is responsive, its not slow at all.

What has changed in Xcode that has turned it into such a hog and what can I do to eliminate or greatly reduce the build times? I had read on other threads/forums to disable debug in the Xcode deployment scheme - but that really defeats the purpose of having Xcode and debuggers when trying to troubleshoot new code and new builds.

As is, I test everything on Android until new versions of my app are as clean as possible, then I port the code over to the iMac and it takes me forever to cleanup UI or plugin issues because it takes sooooooo long to deploy to devices in order for me to test layouts and functionality.

UPDATE 1: For the CLI compile, is there anyway to turn the verbose off? I feel that watching the thousands of lines print to console aren't exactly helping compile times. I haven't found a way to do it (yet).

UPDATE 2: I found some interesting things. It looks like ionic cordova build ios is creating a massive amount of stale files is located outside of the allowed root path. When I do the build from CLI its creating nearly 2500 of them; but I don't see them until I deploy the app from Xcode, they appear in Xcodes issue navigator as its deploying the app.

I then found a way to clear those stale files, in Xcode, clean the project and then immediately run the project:

  1. + SHIFT + K
  2. + SHIFT + R

It takes a few minutes but eventually all those stale files are removed. After that, when I deploy the app to a device it takes about 15 seconds. That is a MASSIVE improvement. However...as soon as I build the app from CLI again ionic cordova build ios - it still takes 5+ minutes to complete the build, and then in Xcode all those stale files are back again causing the deploy to take nearly 3 minutes again. So I truly do think the culprit here is cordova creating these nearly 2500 stale files outside the root path.

Does anyone know how I can fix this or prevent Cordova from creating these stale files?

UPDATE 3:

I opened a bug report/issue with cordova-ios on github. There are some informative responses here with the thought that a specific fix in cordova-ios 7.0 might be a fix and then other messages that are saying no one knows why this is happening....regardless, but I can't upgrade to 7.0 yet.

https://github.com/apache/cordova-ios/issues/1372

0

There are 0 best solutions below