Platform Limitations
macOS Code Signing
macOS code signing only works on macOS. This is a fundamental limitation that cannot be fixed due to Apple’s security requirements.- You cannot sign macOS apps on Windows or Linux
- You must use a Mac or macOS CI service (Travis, GitHub Actions, CircleCI) for macOS builds
- Apple’s codesigning tools are only available on macOS
Native Dependencies
If your app has native dependencies, they can only be compiled on the target platform unless prebuild binaries are provided.Most Node.js modules don’t provide prebuilt binaries. If you have native dependencies, plan to build on each target platform or use CI services.
Cross-Platform Capabilities
Windows users can use the free Electron Build Service to build Linux apps. AppX support may be added in the future.
Building for Multiple Platforms
CLI Flags
By default, electron-builder builds for the current platform and architecture. Use CLI flags to specify targets:Multiple Targets in One Command
Highly Recommended: Build for multiple platforms in a single command for parallel execution. Don’t use separate npm scripts like
npm run dist:mac && npm run dist:win.- Builds run in parallel
- Faster overall build time
- Output directory is automatically cleaned
- No need to manually clean between builds
Configuration
package.json
Docker Support
Use Docker to build Linux and Windows apps from any platform.Docker Images
electron-builder provides official Docker images:Images are also available for Node.js 14, 16, and 18 (e.g.,
builder:18, builder:18-wine). Pin to specific date tags like builder:18-07.23 for reproducible builds.Building with Docker Locally
- Run Docker container:
- Inside container, build your app:
macOS Users: Use Docker for Mac, not Docker Toolbox.
CI/CD Configuration
Travis CI (macOS + Linux + Windows)
.travis.yml
- Use
osx_image: xcode10.2or later for macOS builds - Use
dist: xenialor later for Linux builds - Cache electron and electron-builder downloads
- Clean Wine cache before saving to avoid issues
GitHub Actions
.github/workflows/build.yml
AppVeyor (Windows Only)
Only use AppVeyor if you need to build AppX or have native dependencies without prebuilt binaries. Otherwise, use Travis/GitHub Actions with Docker for Windows builds.
appveyor.yml
Platform-Specific Requirements
macOS
Dependencies (auto-downloaded on macOS 10.12+):- All required dependencies download automatically
- To build RPM:
brew install rpm
Linux
For Linux builds:Recommended: Use Docker to avoid installing system dependencies. See Docker section above.
Windows
No additional dependencies required for building Windows apps on Windows. For other platform builds, use WSL2 with Docker or CI services.Troubleshooting
Native Dependencies Issues
Code Signing Issues
Docker Permission Issues
Cache Issues
Best Practices
- Use CI services for building multiple platforms automatically
- Build in parallel using a single command:
electron-builder -mwl - Use Docker for Linux and Windows builds to avoid dependency issues
- Pin Docker image versions using date tags for reproducible builds
- Cache dependencies on CI to speed up builds
- Separate build jobs by platform on CI for faster parallel execution
- Test on target platforms before releasing
Example: Complete Multi-Platform Setup
package.json
.github/workflows/release.yml