Slow app compilation with new Sierra update
Asked Answered
T

4

30

When I updated my mac to macOS Sierra 10.12.1 time of running application on real device significantly increased. "Run custom script 'Embed Pods Frameworks'" and "Copy Swift standard libraries" take more then 30 minutes to build.

Do someone face the same issue?

Turpitude answered 26/10, 2016 at 9:1 Comment(5)
I'm having the same problem and I'm not able to find the solution. I will let you know if I discover what is the problemScully
Someone here suggested to create a new user: https://mcmap.net/q/443920/-xcode-8-preparing-archive-takes-forever/2491738. Haven't tried it myself though..Canberra
@Canberra yes, I have just tested it and it is a little bit faster. I will use this temporary user account while Apple decides to fix it... Thanks!Scully
Just tested my app on different computer, without new macOS update - everything works fast and fine, so I think that the user is not a problem, but I will try with new Apple user...Turpitude
On my second mac, after updated Sierra and used new GM Xcode, everything is builded normally.Turpitude
S
32

Check your keychain. After updating to Sierra to 10.12.1, I had over 500 copies one of my certificates, and a few others were duplicated a few hundred times.

I removed all the duplicates and kept just one of each, and my code signing time went from 30 seconds per framework down to about 1 second per.

I don't know how or why the certificates were duplicated, but the timing of the issue suggests it was due to updating Sierra.

Specht answered 28/10, 2016 at 5:40 Comment(8)
It was that! Thank you @SpechtTurpitude
Deleting duplicate keychains does not works for me.. Still take 1~2 minutes to code sign frameworks for cocoapods when building to real device.Wayfarer
@Wayfarer Are you experiencing 1-2 minutes per framework, or 1-2 minutes for all frameworks? If the latter, how many frameworks do you have?Specht
@Specht For all frameworks, total 45 libraries in my podfile. I've posted similar question on stackoverflow: #40281540 Seems like other developers are experiencing this issue. Also tried the latest beta cocoapods feature for parallelize code signing: github.com/CocoaPods/CocoaPods/pull/6088 Still no luck :(Wayfarer
@Wayfarer I see code signing taking a second or two per framework, so 1-2 minutes matches my experience given your 45 libraries. Speeding up code signing would be great, but I'm not sure it's possible. CocoaPods may be able to change the way they package the frameworks or may be able to "cache" the code signing results better.Specht
@Specht Found a alternative solution, I've posted as an answer below, perhaps you can give it a try! :)Wayfarer
It did speed up my compile time. I was being driven crazyBirecree
This was the answer for me, too! Just one certificate duplicated over a hundred times.Commination
W
23

2017-03-23 Update

You can skip installing the beta version of CocoaPods, because the COCOAPODS_PARALLEL_CODE_SIGN flag is also evaluated in the current release build.

Original Answer

Found an alternative solution, not best, but at least it's speeding up. It works (for me)

Cocoapods released a new beta version few days ago.

Which allows parallel code signing when running the embed framework script (https://github.com/CocoaPods/CocoaPods/pull/6088#issuecomment-257441733)

  1. Install the latest beta version

gem install cocoapods --pre

  1. Go to your Xcode target build settings and click the + icon at the top

enter image description here

  1. Set COCOAPODS_PARALLEL_CODE_SIGN to true

enter image description here

And enjoy the increased building speed!

Wayfarer answered 1/11, 2016 at 3:52 Comment(5)
Nice. This helps a lot as well. All 8 cores are all working on code signing at once now. Next step - speed up swift compile times!Specht
Thank you! This issue was driving me nuts for a week and a half.Gilpin
how can you compare the timing? I can't see anyComnenus
For those wondering, this is available since CocoaPods v1.2.0. To check - pod --versionMorry
this worked for me : #20649798Slowly
B
17

If keychain looks good, but problems exists – check the preferences and remove all duplicates in this file: ~/Library/Preferences/com.apple.security.plist

For typical setup this file must contain only one record with login keychain reference.

Basenji answered 15/11, 2016 at 8:46 Comment(3)
This list was the problem for me. Removing about five duplicates of login keychain dicts brought down archive time from few hours to few minutes.Cirilo
Same for me, great find!Butterscotch
I cant find this file on 10.12.3Submission
C
0

All the above mentioned approaches didn't work for me. What helped a lot was resetting the System.keychain, which had 25 MB size. This speeded up build times up to 40% on our CI system.

Analyze

du -h /Library/Keychains/System.keychain
good: 60K
bad: 25MB

Reset

sudo systemkeychain -vfcC [password]

Attention: If you have important keys/certs/passwords stored in your System.keychain, you may want to export them before performing the reset and then reimport them on demand. This wasn't necessary for me. My new System.keychain has no content and building projects works absolutely fine.

Culliton answered 26/7, 2017 at 9:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.