question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there a way to speed up build process on Mac?

See original GitHub issue
  • Version: 22.9.1
  • Electron Version: 11.1.0
  • Electron Type (current, beta, nightly):
  • Target: macOS (dmg & zip)

I am noticing that it takes a lot of time (close to 45 - 50 minutes) to make a build for macOS. Just wondering if that process can be sped up.

For the build, I am using standard build configuration which prepares a dmg and a zip file. The process is fairly standard. Here are the steps, the build process goes through:

  1. Compile code & sign binaries (takes approximately 5 minutes)
  2. Notarize application (takes approximately 10 minutes)
  3. Build artifacts [zip, dmg, and dmg.blockmap] (takes approximately 20 minutes). The most of the time is spent in building dmg.blockmap file. Other artifacts are built pretty fast.
  4. Upload artifacts in Azure Storage (takes approximately 10 - 15 minutes depending on the Internet speed).

Now, 2 and 4 are not really in our control as a lot of the time spent in these steps depends on internet connectivity. What I am wondering is if we can somehow speed up step 3?

Here’s the build script I am using:

const builder = require('electron-builder');
const buildCommonConfig = require('./common-build-config.js');

console.log('Building installer for OSX (x64). Please wait....');
const osxConfig = {
  category: 'public.app-category.developer-tools',
  icon: './resources/osx/icon.icns',
  artifactName: 'AppName.${ext}',
  hardenedRuntime: true,
  gatekeeperAssess: false,
  entitlements: './resources/osx/entitlements.mac.plist',
  entitlementsInherit: './resources/osx/entitlements.mac.inherit.plist',
  target: {
    target: 'default',
    arch: ['x64']
  }
};

const osxBuildConfig = Object.assign({
  afterSign: './build-scripts/after-sign-hook.js'//This is where notarization happens.
}, buildCommonConfig);
osxBuildConfig.mac = osxConfig;

builder.build({
  config: osxBuildConfig
})
.then((result) => {
  console.log('Done building OSX (x64) installer....');
  console.log(result);
})
.catch((error) => {
  console.log('Error building OSX (x64) installer....');
  console.log(error);
});

To compare, building for Windows (NSIS) and Linux (AppImage) takes about 15 - 20 minutes.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:12

github_iconTop GitHub Comments

1reaction
gmantricommented, Feb 25, 2021

Hi @mmaietta. Thanks for all your help. I really appreciate it. So I asked a team member of mine to do the build on his Mac (which is a newer machine) and on his machine the build completed in 15 minutes (no notarization and uploading in storage, just build). So it looks like an issue with just my computer.

However let me keep this issue open for now. Over this weekend I will try to do what you suggested. I will report with my findings.

1reaction
mmaiettacommented, Feb 18, 2021

@gmantri try applying this patch to your project and report back with the results, preferably also with the compilation duration delta between with & without the patch. app-builder-lib+22.10.5.patch

diff --git a/node_modules/app-builder-lib/out/targets/ArchiveTarget.js b/node_modules/app-builder-lib/out/targets/ArchiveTarget.js
index 84c114b..2c156e1 100644
--- a/node_modules/app-builder-lib/out/targets/ArchiveTarget.js
+++ b/node_modules/app-builder-lib/out/targets/ArchiveTarget.js
@@ -121,7 +121,7 @@ class ArchiveTarget extends _core().Target {
       await (0, _archive().archive)(format, artifactPath, dirToArchive, archiveOptions);
 
       if (this.isWriteUpdateInfo && format === "zip") {
-        updateInfo = await (0, _differentialUpdateInfoBuilder().appendBlockmap)(artifactPath);
+        // updateInfo = await (0, _differentialUpdateInfoBuilder().appendBlockmap)(artifactPath);
       }
     }
 

Read more comments on GitHub >

github_iconTop Results From Across the Web

Improving the speed of incremental builds - Apple Developer
Before you perform any build optimizations, always gather timing information to see where optimizations might be most effective. Open your project in Xcode...
Read more >
Speeding Up Xcode Builds - Ricardo Castellanos - Medium
This option allows Xcode to speed up total build time by building targets that do not depend on each other at the same...
Read more >
How to speed up a slow Mac - Macworld
1. One of the most obvious things you can do if your Mac has slowed down is restart it. However, we understand that...
Read more >
Why Is My Mac So Slow? | 9 Fixes to Speed Up Your Mac - Avast
This is the easiest way to speed up your iMac, Mac mini, and Mac Pro. Turn off your Mac completely and unplug the...
Read more >
18 tips for speeding up a slow Mac - Setapp
Essentially everything you touch within your computer leaves cache files: system, browsers, apps, user preferences, etc. Over time, the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found