Lesson 16 of 28 · javascript
Creating Installers – NSIS (Windows), DMG (macOS), AppImage (Linux)
Duration: 10 mins
Creating Installers – NSIS (Windows), DMG (macOS), AppImage (Linux)
NSIS (Windows)
electron-builder uses NSIS under the hood. You can customise the installer via the nsis object in package.json:
"nsis": {
"oneClick": false,
"perMachine": true,
"allowToChangeInstallationDirectory": true,
"include": "build/installer.nsh"
}
A custom NSIS script (installer.nsh) can add extra steps (e.g., install a service).
DMG (macOS)
electron-builder creates a DMG that displays a drag‑to‑Applications window.
You can tweak the appearance:
"dmg": {
"icon": "build/icon.icns",
"background": "build/dmg-bg.png",
"contents": [
{ "x": 130, "y": 220 },
{ "x": 410, "y": 220, "type": "link", "path": "/Applications" }
]
}
AppImage (Linux)
electron-builder bundles everything into a self‑extracting AppImage.
Add Linux specific config if you need desktop icons:
"linux": {
"target": "AppImage",
"category": "Utility",
"icon": "build/icon.png"
}
Run npm run build and you’ll find MyApp-Setup.exe, MyApp.dmg, and MyApp.AppImage in the dist/ folder.