Linux
The top-level linux key contains set of options instructing electron-builder on how it should build Linux targets. These options applicable for any Linux target.
Linux Target Overview
electron-builder supports a wide range of Linux package formats. Choose based on your target audience and distribution method:
| Target | Format | Best For | Distro Support |
|---|---|---|---|
AppImage | Single file | Broad compatibility, no install | Universal |
deb | Debian package | Ubuntu, Debian, Mint | Debian-based |
rpm | RPM package | Fedora, RHEL, openSUSE | Red Hat-based |
snap | Snap package | Ubuntu-primary | Any (snapd required) |
flatpak | Flatpak | Cross-distro sandboxed | Any (flatpak required) |
pacman | Arch package | Arch Linux, Manjaro | Arch-based |
apk | Alpine package | Alpine Linux, containers | Alpine |
freebsd | FreeBSD pkg | FreeBSD | FreeBSD |
p5p | Solaris IPS | Solaris, illumos | Solaris-based |
zip, 7z, tar.* | Archive | Custom CDN distribution | Universal |
dir | Directory | Development/debugging | N/A |
The default targets are AppImage and Snap.
Common Linux Configuration
Options set in the linux key apply to all Linux targets:
linux:
target:
- AppImage
- deb
- rpm
category: Utility # freedesktop.org category
synopsis: "A short description" # one-line description
description: "Full description" # longer description
maintainer: "Name <email>" # package maintainer
vendor: "My Company" # package vendor
mimeTypes:
- application/x-myapp
executableArgs:
- --enable-features=WebContentsFocusOnResize
Desktop File Customization
All Linux targets include a .desktop file for application menu integration. Customize it via linux.desktop:
linux:
desktop:
entry:
Name: My Application
Comment: A fantastic application
Categories: Office;Productivity
Keywords: productivity;notes;organizer
StartupWMClass: my-app # helps window managers match window to icon
Terminal: false
Type: Application
desktopActions:
NewWindow:
Name: New Window
Exec: my-app --new-window
NewFile:
Name: New File
Exec: my-app --new-file
Standard freedesktop.org category values include: AudioVideo, Audio, Video, Development, Education, Game, Graphics, Network, Office, Science, Settings, System, Utility.
See the freedesktop.org specification for all valid keys.
Icon Configuration
Provide a directory of PNG icons named with their size:
linux:
icon: build/icons/
Files must be named NxN.png (e.g., 256x256.png, 512x512.png). If not specified, electron-builder auto-generates Linux icons from the macOS .icns file (if present) or the Windows .ico file.
Recommended sizes: 16, 24, 32, 48, 64, 96, 128, 256, 512 pixels.
Debian Package (deb)
The deb target creates a .deb package installable via apt on Debian, Ubuntu, Mint, and other Debian-based distributions.
deb:
depends:
- libgtk-3-0
- libnotify4
- libnss3
- libxss1
- libxtst6
- xdg-utils
- libatspi2.0-0
- libuuid1
- libsecret-1-0
recommends:
- libappindicator3-1 # system tray support
packageCategory: utils
priority: optional
Common depends packages for Electron apps:
libgtk-3-0— GTK3 (required)libnotify4— desktop notificationslibnss3— NSS (Chromium networking)libxss1— screen saver extensionlibxtst6— X test extensionxdg-utils— desktop integration utilitieslibatspi2.0-0— accessibilitylibuuid1— UUID supportlibsecret-1-0— keychain/Secret Service
Priority values: required, important, standard, optional (use optional for most apps)
RPM Package (rpm)
The rpm target creates a .rpm package for Fedora, RHEL, CentOS, openSUSE, and other RPM-based distributions.
rpm:
depends:
- libXScrnSaver
- libnotify
- libappindicator
- nss
- gtk3
compression: xz # gz | bzip2 | xz | lzo (default: xz)
packageCategory: Applications/Internet
Common depends for Electron on RPM systems:
gtk3— GTK3libnotify— notificationslibXScrnSaver— screen savernss— networking
After-install/after-remove scripts:
rpm:
afterInstall: build/scripts/after-install.sh
afterRemove: build/scripts/after-remove.sh
Pacman Package (pacman)
The pacman target is in beta. Test thoroughly before distributing.
Creates a .pkg.tar.zst package for Arch Linux and Arch-based distributions (Manjaro, EndeavourOS, etc.):
pacman:
depends:
- gtk3
- libnotify
- nss
- libxss
- libxtst
- xdg-utils
- at-spi2-core
- libsecret
Alpine APK Package (apk)
Creates an .apk package for Alpine Linux, commonly used in Docker containers:
apk:
depends:
- gtk+3.0
- libnotify
- nss
Alpine uses musl libc rather than glibc. Electron bundles its own copy of glibc-dependent libraries, but some native modules may not be compatible with Alpine without recompilation.
FreeBSD Package (freebsd)
Creates a .pkg package (not to be confused with macOS PKG) for FreeBSD systems:
freebsd:
depends:
- gtk3
- libnotify
- nss
FPM Passthrough Options
The DEB, RPM, Pacman, APK, FreeBSD, and P5P targets are built using FPM internally. Pass additional FPM command-line arguments:
deb:
fpm:
- "--deb-changelog=CHANGELOG.md"
- "--deb-no-default-config-files"
AppArmor Profile (Ubuntu 24+)
Ubuntu 24.04 introduced mandatory AppArmor profiles for application sandboxing. Specify a custom profile:
deb:
appArmorProfile: build/apparmor-profile
Without a profile, the app may be restricted by Ubuntu's default profile. See the AppArmor documentation for profile syntax.
Base Linux Configuration
Interface: LinuxConfiguration
Extends
Properties
appId?
readonlyoptionalappId?:string|null
The application id. Used as CFBundleIdentifier for MacOS and as Application User Model ID for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.
Default
com.electron.${name}
Inherited from
PlatformSpecificBuildOptions.appId
artifactName?
readonlyoptionalartifactName?:string|null
The artifact file name template. Defaults to ${productName}-${version}.${ext} (some target can have other defaults, see corresponding options).
Inherited from
PlatformSpecificBuildOptions.artifactName
asar?
readonlyoptionalasar?:boolean|AsarOptions|null
Whether to package the application's source code into an archive, using Electron's archive format.
Node modules, that must be unpacked, will be detected automatically, you don't need to explicitly set asarUnpack - please file an issue if this doesn't work.
Default
true
Inherited from
PlatformSpecificBuildOptions.asar
asarUnpack?
readonlyoptionalasarUnpack?:string|string[] |null
A glob patterns relative to the app directory, which specifies which files to unpack when creating the asar archive.
Inherited from
PlatformSpecificBuildOptions.asarUnpack
category?
readonlyoptionalcategory?:string|null
The application category.
Inherited from
compression?
readonlyoptionalcompression?:CompressionLevel|null
The compression level. If you want to rapidly test build, store can reduce build time significantly. maximum doesn't lead to noticeable size difference, but increase build time.
Default
normal
Inherited from
PlatformSpecificBuildOptions.compression
defaultArch?
readonlyoptionaldefaultArch?:string
The default architecture to build for when no --arch flag is specified.
Defaults to the current machine's architecture.
Inherited from
PlatformSpecificBuildOptions.defaultArch
description?
readonlyoptionaldescription?:string|null
As description from application package.json, but allows you to specify different for Linux.
Inherited from
CommonLinuxOptions.description
desktop?
readonlyoptionaldesktop?:LinuxDesktopFile|null
The Desktop file
Inherited from
detectUpdateChannel?
readonlyoptionaldetectUpdateChannel?:boolean
Whether to infer update channel from application version pre-release components. e.g. if version 0.12.1-alpha.1, channel will be set to alpha. Otherwise to latest.
This does not apply to github publishing, which will never auto-detect the update channel.
Default
true
Inherited from
PlatformSpecificBuildOptions.detectUpdateChannel
disableDefaultIgnoredFiles?
optionaldisableDefaultIgnoredFiles?:boolean|null
Whether to exclude all default ignored files(https://www.electron.build/contents#files) and options. Defaults to false.
Default
false
Inherited from
PlatformSpecificBuildOptions.disableDefaultIgnoredFiles
electronLanguages?
readonlyoptionalelectronLanguages?:string|string[]
The electron locales to keep. By default, all Electron locales used as-is.
Inherited from
PlatformSpecificBuildOptions.electronLanguages
electronUpdaterCompatibility?
readonlyoptionalelectronUpdaterCompatibility?:string|null
The electron-updater compatibility semver range.
Inherited from
PlatformSpecificBuildOptions.electronUpdaterCompatibility
executableArgs?
readonlyoptionalexecutableArgs?:string[] |null
The executable parameters. Pass to executableName
Inherited from
CommonLinuxOptions.executableArgs
executableName?
readonlyoptionalexecutableName?:string|null
The executable name. Defaults to productName
Note: Except for Linux, where this would constitute a breaking change in previous behavior and lead to both invalid executable names and Desktop files. Ref comments in: https://github.com/electron-userland/electron-builder/pull/9068
Inherited from
PlatformSpecificBuildOptions.executableName
extraFiles?
optionalextraFiles?:string|FileSet| (string|FileSet)[] |null
The same as extraResources but copy into the app's content directory (Contents for MacOS, root directory for Linux and Windows).
Inherited from
PlatformSpecificBuildOptions.extraFiles
extraResources?
optionalextraResources?:string|FileSet| (string|FileSet)[] |null
A glob patterns relative to the project directory, when specified, copy the file or directory with matching names directly into the app's resources directory (Contents/Resources for MacOS, resources for Linux and Windows).
File patterns (and support for from and to fields) the same as for files.
Inherited from
PlatformSpecificBuildOptions.extraResources
fileAssociations?
readonlyoptionalfileAssociations?:FileAssociation|FileAssociation[]
The file associations.
Inherited from
PlatformSpecificBuildOptions.fileAssociations
files?
optionalfiles?:string|FileSet| (string|FileSet)[] |null
A glob patterns relative to the app directory, which specifies which files to include when copying files to create the package.
Defaults to:
[
"**/*",
"!**/node_modules/*/{CHANGELOG.md,README.md,README,readme.md,readme}",
"!**/node_modules/*/{test,__tests__,tests,powered-test,example,examples}",
"!**/node_modules/*.d.ts",
"!**/node_modules/.bin",
"!**/*.{iml,o,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,xproj}",
"!.editorconfig",
"!**/._*",
"!**/{.DS_Store,.git,.hg,.svn,CVS,RCS,SCCS,.gitignore,.gitattributes}",
"!**/{__pycache__,thumbs.db,.flowconfig,.idea,.vs,.nyc_output}",
"!**/{appveyor.yml,.travis.yml,circle.yml}",
"!**/{npm-debug.log,yarn.lock,.yarn-integrity,.yarn-metadata.json}"
]
Development dependencies are never copied in any case. You don't need to ignore it explicitly. Hidden files are not ignored by default, but all files that should be ignored, are ignored by default.
Default pattern **/* is not added to your custom if some of your patterns is not ignore (i.e. not starts with !). package.json and **/node_modules/**/* (only production dependencies will be copied) is added to your custom in any case. All default ignores are added in any case — you don't need to repeat it if you configure own patterns.
May be specified in the platform options (e.g. in the mac).
You may also specify custom source and destination directories by using FileSet objects instead of simple glob patterns.
[
{
"from": "path/to/source",
"to": "path/to/destination",
"filter": ["**/*", "!foo/*.js"]
}
]
You can use file macros in the from and to fields as well. from and to can be files and you can use this to rename a file while packaging.
Inherited from
PlatformSpecificBuildOptions.files
forceCodeSigning?
readonlyoptionalforceCodeSigning?:boolean
Whether to fail if app will be not code signed.
Default
false
Inherited from
PlatformSpecificBuildOptions.forceCodeSigning
generateUpdatesFilesForAllChannels?
readonlyoptionalgenerateUpdatesFilesForAllChannels?:boolean
Please see Building and Releasing using Channels.
Default
false
Inherited from
PlatformSpecificBuildOptions.generateUpdatesFilesForAllChannels
icon?
readonlyoptionalicon?:string
The path to icon set directory or one png file, relative to the build resources or to the project directory. The icon filename must contain the size (e.g. 32x32.png) of the icon. By default will be generated automatically based on the macOS icns file.
Overrides
PlatformSpecificBuildOptions.icon
maintainer?
readonlyoptionalmaintainer?:string|null
The maintainer. Defaults to author.
mimeTypes?
readonlyoptionalmimeTypes?:string[] |null
The mime types in addition to specified in the file associations. Use it if you don't want to register a new mime type, but reuse existing.
Inherited from
protocols?
The URL protocol schemes.
Inherited from
PlatformSpecificBuildOptions.protocols
publish?
optionalpublish?:Publish
Publisher configuration. See Auto Update for more information.
Inherited from
PlatformSpecificBuildOptions.publish
releaseInfo?
readonlyoptionalreleaseInfo?:ReleaseInfo
The release info. Intended for command line usage:
-c.releaseInfo.releaseNotes="new features"
Inherited from
PlatformSpecificBuildOptions.releaseInfo
synopsis?
readonlyoptionalsynopsis?:string|null
The short description.
Inherited from
target?
readonlyoptionaltarget?:TargetConfigType
Target package type: list of AppImage, flatpak, snap, deb, rpm, freebsd, pacman, p5p, apk, 7z, zip, tar.xz, tar.lz, tar.gz, tar.bz2, dir.
electron-builder docker image can be used to build Linux targets on any platform.
Please do not put an AppImage into another archive like a .zip or .tar.gz.
Default
AppImage
Overrides
PlatformSpecificBuildOptions.target
vendor?
readonlyoptionalvendor?:string|null
The vendor. Defaults to author.
Debian Package Options
The top-level deb key contains set of options for Debian packages.
Interface: DebOptions
Extends
Properties
afterInstall?
readonlyoptionalafterInstall?:string|null
File path to script to be passed to FPM for --after-install arg.
Inherited from
LinuxTargetSpecificOptions.afterInstall
afterRemove?
readonlyoptionalafterRemove?:string|null
File path to script to be passed to FPM for --after-remove arg.
Inherited from
LinuxTargetSpecificOptions.afterRemove
appArmorProfile?
readonlyoptionalappArmorProfile?:string|null
File path to custom AppArmor profile (Ubuntu 24+)
Inherited from
LinuxTargetSpecificOptions.appArmorProfile
artifactName?
readonlyoptionalartifactName?:string|null
The artifact file name template.
Inherited from
LinuxTargetSpecificOptions.artifactName
category?
readonlyoptionalcategory?:string|null
The application category.
Inherited from
LinuxTargetSpecificOptions.category
compression?
readonlyoptionalcompression?:"gz"|"bzip2"|"xz"|"zst"|null
Default
xz
Overrides
LinuxTargetSpecificOptions.compression
depends?
readonlyoptionaldepends?:string[] |null
Package dependencies.
If need to support Debian, libappindicator1 should be removed, it is deprecated in Debian.
If need to support KDE, gconf2 and gconf-service should be removed as it's no longer used by GNOME.
Default
["libgtk-3-0", "libnotify4", "libnss3", "libxss1", "libxtst6", "xdg-utils", "libatspi2.0-0", "libuuid1", "libsecret-1-0"]
Overrides
LinuxTargetSpecificOptions.depends
description?
readonlyoptionaldescription?:string|null
As description from application package.json, but allows you to specify different for Linux.
Inherited from
LinuxTargetSpecificOptions.description
desktop?
readonlyoptionaldesktop?:LinuxDesktopFile|null
The Desktop file
Inherited from
LinuxTargetSpecificOptions.desktop
executableArgs?
readonlyoptionalexecutableArgs?:string[] |null
The executable parameters. Pass to executableName
Inherited from
LinuxTargetSpecificOptions.executableArgs
fpm?
readonlyoptionalfpm?:string[] |null
Advanced only The fpm options.
Example: ["--before-install=build/deb-preinstall.sh", "--after-upgrade=build/deb-postinstall.sh"]
Inherited from
LinuxTargetSpecificOptions.fpm
icon?
readonlyoptionalicon?:string
Inherited from
LinuxTargetSpecificOptions.icon
maintainer?
readonlyoptionalmaintainer?:string|null
Inherited from
LinuxTargetSpecificOptions.maintainer
mimeTypes?
readonlyoptionalmimeTypes?:string[] |null
The mime types in addition to specified in the file associations. Use it if you don't want to register a new mime type, but reuse existing.
Inherited from
LinuxTargetSpecificOptions.mimeTypes
packageCategory?
readonlyoptionalpackageCategory?:string|null
The package category.
Overrides
LinuxTargetSpecificOptions.packageCategory
packageName?
readonlyoptionalpackageName?:string|null
The name of the package.
Inherited from
LinuxTargetSpecificOptions.packageName
priority?
readonlyoptionalpriority?:string|null
The Priority attribute.
publish?
optionalpublish?:Publish
Inherited from
LinuxTargetSpecificOptions.publish
recommends?
readonlyoptionalrecommends?:string[] |null
The recommended package dependencies.
Default
["libappindicator3-1"]
synopsis?
readonlyoptionalsynopsis?:string|null
The short description.
Inherited from
LinuxTargetSpecificOptions.synopsis
vendor?
readonlyoptionalvendor?:string|null
Inherited from
LinuxTargetSpecificOptions.vendor
All LinuxTargetSpecificOptions can also be specified in deb to customize Debian packages.
LinuxTargetSpecificOptions — APK, FreeBSD, Pacman, P5P and RPM Options
The top-level apk, freebsd, pacman, p5p and rpm keys contain options for their respective Linux targets.
Interface: LinuxTargetSpecificOptions
Extends
Extended by
Properties
afterInstall?
readonlyoptionalafterInstall?:string|null
File path to script to be passed to FPM for --after-install arg.
afterRemove?
readonlyoptionalafterRemove?:string|null
File path to script to be passed to FPM for --after-remove arg.
appArmorProfile?
readonlyoptionalappArmorProfile?:string|null
File path to custom AppArmor profile (Ubuntu 24+)
artifactName?
readonlyoptionalartifactName?:string|null
The artifact file name template.
Inherited from
TargetSpecificOptions.artifactName
category?
readonlyoptionalcategory?:string|null
The application category.
Inherited from
compression?
readonlyoptionalcompression?:"gz"|"bzip2"|"xz"|"xzmt"|"gzip"|"zst"|"zstd"|null
The compression type passed to fpm. For deb, rpm, and pacman targets prefer the
typed per-format interfaces (DebOptions, RpmOptions, PacmanOptions) which narrow
this to only the values that fpm actually accepts for that format.
Default
xz
depends?
readonlyoptionaldepends?:string[] |null
Package dependencies.
rpm defaults to ["gtk3", "libnotify", "nss", "libXScrnSaver", "(libXtst or libXtst6)", "xdg-utils", "at-spi2-core", "(libuuid or libuuid1)"]
pacman defaults to ["c-ares", "ffmpeg", "gtk3", "http-parser", "libevent", "libvpx", "libxslt", "libxss", "minizip", "nss", "re2", "snappy", "libnotify", "libappindicator-gtk3"]
description?
readonlyoptionaldescription?:string|null
As description from application package.json, but allows you to specify different for Linux.
Inherited from
CommonLinuxOptions.description
desktop?
readonlyoptionaldesktop?:LinuxDesktopFile|null
The Desktop file
Inherited from
executableArgs?
readonlyoptionalexecutableArgs?:string[] |null
The executable parameters. Pass to executableName
Inherited from
CommonLinuxOptions.executableArgs
fpm?
readonlyoptionalfpm?:string[] |null
Advanced only The fpm options.
Example: ["--before-install=build/deb-preinstall.sh", "--after-upgrade=build/deb-postinstall.sh"]
icon?
readonlyoptionalicon?:string
maintainer?
readonlyoptionalmaintainer?:string|null
mimeTypes?
readonlyoptionalmimeTypes?:string[] |null
The mime types in addition to specified in the file associations. Use it if you don't want to register a new mime type, but reuse existing.
Inherited from
packageCategory?
readonlyoptionalpackageCategory?:string|null
The package category.
packageName?
readonlyoptionalpackageName?:string|null
The name of the package.
publish?
optionalpublish?:Publish
Inherited from
synopsis?
readonlyoptionalsynopsis?:string|null
The short description.
Inherited from
vendor?
readonlyoptionalvendor?:string|null