Log In

For Creators and Admin

E-mail

Your Password

Forgot password?

BLOG ON

How to Package and Distribute an Electron App for Windows and macOS

PUBLISHED ON - 17th October, 2026 · 6 min read

Copy URL

WhatsApp

Facebook

E-mail

PUBLISHED BY

Aditya Prem Sharma

Aditya Prem Sharma

Product Specialist


Table of Contents

How to Package and Distribute an Electron App for Windows an

Building an Electron app is only half the job. To ship it to real users, you need to package your application, create installers for Windows and macOS, sign your releases, and deliver updates safely.

For most Electron projects, Electron Forge or electron-builder can automate much of this process. The right setup depends on whether you want a simple downloadable installer, automatic updates, or distribution through an app store.

This guide covers the complete release workflow, including Windows .exe installers, macOS .dmg files, code signing, notarization, CI/CD, and common packaging errors.

1. Choose the Right Packaging Tool

Electron does not include a complete installer and distribution workflow in its core runtime. You need an additional tool to turn your application into distributable files. Electron's packaging guide explains the available approach.

ToolBest forKey advantage
Electron ForgeNew Electron projectsIntegrated packaging and distribution workflow
electron-builderCustom release pipelinesFlexible installer targets, signing, and publishing
Electron PackagerCustom packaging workflowsDirect control over application packaging

Which should you choose?

  • Choose Electron Forge if you want to follow Electron's official packaging workflow.
  • Choose electron-builder if you need configurable Windows and macOS installers, publishing, and an integrated release setup.
  • Choose Electron Packager if you want to build more of the release process yourself.

For this tutorial, we'll use electron-builder to demonstrate a practical Windows and macOS release pipeline.

2. Prepare Your Electron Project

Before packaging, make sure your application starts correctly in development and that its production files are ready.

FILE STRUCTURE

electron-desktop-app/
  src/
    main.js
│   ├── preload.js
│   └── renderer/
├── build/
│   ├── icon.ico
│   └── icon.icns
├── package.json
└── package-lock.json

Your exact structure may differ if you use React, Next.js, Vite, or another frontend framework.

Install electron-builder as a development dependency:

npm install --save-dev electron-builder

Ensure your package.json contains the application entry point, a valid application name, and a version.

json

{
  "name": "electron-desktop-app",
  "version": "1.0.0",
  "main": "src/main.js"
}

Keep your renderer build separate from your Electron main process where appropriate, and ensure production asset paths work after packaging.

Warning

Do not package development-only servers, test credentials, private API keys, or local environment files containing secrets. Anything shipped to a desktop client should be treated as potentially inspectable.

3. Configure Windows and macOS Builds

Add a build configuration and release scripts to your package.json. The following is a starter configuration for electron-builder v26-style settings.

json

{
  "name": "electron-desktop-app",
  "version": "1.0.0",
  "main": "src/main.js",
  "scripts": {
    "start": "electron .",
    "dist:win": "electron-builder --win",
    "dist:mac": "electron-builder --mac",
    "dist:all": "electron-builder --win --mac"
  },
  "devDependencies": {
    "electron": "^YOUR_INSTALLED_ELECTRON_VERSION",
    "electron-builder": "^26.0.0"
  },
  "build": {
    "appId": "com.example.desktopapp",
    "productName": "Desktop App",
    "directories": {
      "output": "release"
    },
    "files": [
      "src/**/*",
      "package.json"
    ],
    "win": {
      "target": ["nsis"],
      "icon": "build/icon.ico"
    },
    "mac": {
      "target": ["dmg", "zip"],
      "icon": "build/icon.icns"
    }
  }
}

Replace the Electron version placeholder with the version already installed in your project. Adjust files to include all production assets, dependencies, and built renderer files your app requires.

The configuration produces these target types:

  • Windows: NSIS installer, typically an .exe.
  • macOS: .dmg disk image and .zip archive.

The appId should be a stable, reverse-domain identifier for your product. The productName controls the display name used in the packaged application.

Refer to the electron-builder Windows documentation and macOS documentation for additional target and configuration options.

4. Build a Windows Installer

To generate the Windows installer, run:

npm run dist:win

Once packaging finishes, inspect the release directory. You should find an installer similar to:

release/
└── Desktop App Setup 1.0.0.exe

The exact filename depends on your configuration.

For most desktop applications distributed directly from a website, NSIS is a useful default. It supports a familiar installation experience, including choosing an installation location and creating shortcuts.

Before releasing the installer, test it on a clean Windows machine or virtual machine.

Check that:

  • The installer completes without errors.
  • The app opens from the Start menu or desktop shortcut.
  • Application data is stored in an appropriate user-data directory.
  • Files, downloads, permissions, and external links work correctly.
  • Uninstalling the application behaves as expected.

Should you distribute an installer or a portable executable?

An installer is generally preferable for production applications because it can create shortcuts and manage installation and uninstallation. A portable build may be useful for users who do not want a traditional installation, but it can require additional decisions about updates and data storage.

5. Build a macOS DMG and ZIP

To build macOS distributables, run this command on a Mac:

npm run dist:mac

The output should include files similar to:

release/
├── Desktop App-1.0.0.dmg
└── Desktop App-1.0.0-mac.zip

A .dmg file is a common format for direct macOS distribution. Users open the disk image and typically drag the app into their Applications folder.

A .zip archive is useful for direct downloads and certain update workflows.

Important: Creating a DMG does not automatically make your app trusted by macOS. For a public release outside the Mac App Store, you should code-sign the application and complete Apple's notarization process. These steps are covered in the next section.

6. Sign Your App and Notarize macOS Releases

Code signing establishes the publisher's identity and helps operating systems verify that an application has not been tampered with. Apple's notarization service performs additional automated security checks on software distributed outside its store. Electron's code-signing guide explains the distinction.

RequirementWindowsmacOS direct distribution
Code signingStrongly recommendedExpected for a smooth installation experience
NotarizationNot applicableRequired for normal distribution to modern macOS users
Typical credentialsWindows signing certificateApple Developer ID Application certificate
Main purposeIdentify the publisher and verify integrityEstablish trust and pass Gatekeeper checks

Windows code signing

Obtain a suitable Windows code-signing certificate and configure electron-builder to use it. Keep the certificate and password in your CI/CD secret store rather than committing them to source control.

bash

WIN_CSC_LINK=/secure/path/windows-certificate.pfx
WIN_CSC_KEY_PASSWORD=your-certificate-password

These are example environment variable names, not values to publish. Use your actual secret-management configuration and follow the signing method supported by your electron-builder version.

macOS code signing and notarization

For direct distribution, you'll generally need an Apple Developer Program membership, a Developer ID Application certificate, and credentials for notarization.

Typical CI environment variables include:

CSC_LINK=/secure/path/mac-certificate.p12
CSC_KEY_PASSWORD=your-certificate-password
APPLE_ID=developer@example.com
APPLE_APP_SPECIFIC_PASSWORD=your-app-specific-password
APPLE_TEAM_ID=YOUR_TEAM_ID

For automated releases, an App Store Connect API key is another supported notarization authentication method. Configure the appropriate credentials and signing settings for your build tool.

Never commit certificates, passwords, API keys, or private signing material to your repository. Store them as protected CI/CD secrets and restrict access.

See Apple's notarization documentation for the official requirements.

Important

An unsigned build can be useful for internal testing, but it is not the ideal production release. Signing and notarization should be planned before distributing your app to customers.

7. Automate Builds With CI/CD

Building both platforms manually for every release becomes repetitive and error-prone. A CI/CD pipeline can install dependencies, run tests, package the application, sign the release, and upload the resulting files.

A practical release pipeline looks like this:

Release tag
Run lint and tests
Build Windows release
Package installer
Sign installer
Build macOS release
Package DMG and ZIP
Sign application
Notarize release
Publish approved artifacts

For reliable releases, use Windows and macOS runners where appropriate. Cross-platform packaging can be possible in some configurations, but native runners make platform-specific signing, testing, and troubleshooting more predictable.

Store release artifacts in a controlled location, such as your download server or a release repository. Publish only after validation succeeds.

For teams that need to distribute updates after launch, see Electron's distribution overview and application updating guide.

8. Test the Release Before Publishing

A successful build only confirms that the packaging process completed. It does not prove that the application works correctly on a customer's computer.

Use this release checklist before publishing:

  • Included: Verify the correct app name, icon, and version.
  • Included: Install and launch the Windows build on a clean environment.
  • Included: Install and launch the macOS build on a supported Mac.
  • Included: Test sign-in, API calls, file operations, and offline behavior where applicable.
  • Included: Verify signing and notarization status.
  • Included: Check installer, uninstall, and upgrade behavior.
  • Included: Confirm the app does not rely on local development paths.
  • Included: Scan logs for crashes and startup errors.
  • Included: Test automatic updates if your application supports them.
  • Included: Publish checksums and release notes where useful.

Test on the architectures you intend to support, such as Windows x64 and macOS Apple Silicon. If you also support Intel Macs, build and test that target explicitly.

Common packaging problems

ProblemLikely causeWhat to check
App opens in development but fails after packagingIncorrect asset paths or missing filesProduction paths and the files configuration
macOS reports an unidentified developerMissing or unsuitable signingDeveloper ID signing and notarization
Windows shows an unknown publisherInstaller is unsigned or lacks established reputationCertificate configuration and signature
Native module fails at runtimeModule was built for an incompatible Electron ABI or architectureRebuild the native dependency for the target Electron version
Installer works locally but not on another machineMissing dependency, permissions issue, or environment assumptionClean-machine testing and runtime logs
Update failsIncorrect update feed, version metadata, or signing setupUpdate configuration and published artifacts

FAQ

How do I create an EXE file from an Electron app?

Configure electron-builder or Electron Forge with a Windows target, then run the appropriate packaging command. With the example above, use npm run dist:win to generate a Windows installer.

How do I package an Electron app for macOS?

Build the macOS target and generate a .dmg or .zip distributable. For public distribution outside the Mac App Store, configure code signing and notarization.

Can I build Windows and macOS installers on one computer?

Some cross-platform build combinations are supported, but signing and native dependencies can complicate the process. Separate Windows and macOS CI runners are a dependable choice for production releases.

Is Electron Forge better than electron-builder?

Neither is universally better. Forge provides an integrated workflow aligned with Electron's official documentation, while electron-builder offers a flexible configuration system for installers and release distribution. Choose based on your build targets and release requirements.

How do Electron apps receive automatic updates?

You need an update mechanism, a suitable publishing location, and correctly versioned release artifacts. Electron's update options depend on your operating systems and distribution format. Plan signing and update verification as part of the release architecture.

Does packaging an Electron app protect its source code?

Packaging bundles application files, and ASAR archives can organize those files, but neither is a reliable way to hide secrets or make client-side code impossible to inspect. Keep sensitive business logic and credentials on trusted backend services.

How much does it cost to distribute an Electron app?

Packaging tools can be free, but production distribution may involve code-signing certificates, Apple Developer Program membership, CI runners, hosting, update infrastructure, and ongoing maintenance. Actual costs depend on your distribution model and security requirements.

Build a Desktop App That Is Ready for Production

Packaging is only one part of shipping a reliable desktop application. A production-ready release also needs secure architecture, platform-specific testing, signing, update handling, and a maintainable delivery pipeline.

At Software Studio Pro, we help businesses build custom web, desktop, and mobile software with a focus on production readiness, performance, and long-term maintainability.

Explore our custom software development services to discuss your desktop application or release pipeline.

Ready to bring your business idea to life? Contact us today and let's build something amazing together!

Contact Us

Table of Contents

READ MORE BLOGS

Table of Contents