Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons

© 2026 BraveProgrammer. All rights reserved.

  1. Courses
  2. /
  3. Electron.js Desktop App Development

Lesson 14 of 28 · javascript

Packaging & Distribution – electron‑builder

Duration: 12 mins

Packaging & Distribution – electron‑builder

electron‑builder is the most popular tool for creating installers for Windows (nsis), macOS (dmg, pkg) and Linux (AppImage, deb).

Install

npm install --save-dev electron-builder

Add build config to package.json

"build": {
  "appId": "com.example.myapp",
  "productName": "MyApp",
  "directories": { "output": "dist" },
  "files": [ "dist/**/*", "main/**/*", "preload/**/*", "package.json" ],
  "mac": { "target": "dmg" },
  "win": { "target": "nsis" },
  "linux": { "target": "AppImage" }
}

Scripts

"scripts": {
  "build": "electron-builder",
  "dist": "npm run build"
}

Run npm run build – you’ll get platform‑specific installers in the dist/ folder.

Code signing (macOS)

  1. Create an Apple Developer ID certificate.
  2. Add to build config:
"mac": {
  "identity": "Developer ID Application: Your Name (TEAMID)"
}

Code signing (Windows)

  • Obtain a code‑signing certificate (pfx file)
  • Add to config:
"win": {
  "certificateFile": "cert.pfx",
  "certificatePassword": "your‑password"
}
Previous: Auto‑Updates with electron‑updaterNext: Code Signing – macOS & Windows