Skip to content

Installers

Disk images, Windows setups and Linux packages for the desktop, and the command-line programs they ship beside the app.

For the desktop targets, build writes what users install the app from into dist/releases, each with a .sha256 checksum:

Target Installer
macOS <name>-<version>-macos-<arch>.dmg, a disk image showing the app, an arrow and a link to Applications to drag it to, signed with sign.identity and notarized
Windows <name>-<version>-windows-<arch>-setup.exe, a native Windows installer that installs for the user, again in the folder the user chose before, closing the app if it runs, with a Start menu shortcut, an optional desktop one and an uninstaller that removes only what it installed, signed with sign.certificate where the app signs Windows packages; windows.command_line also installs the .com companion and puts the app’s folder on the user’s Path, so consoles opened after installing run the app’s command, while Win+R, which finds the companion too, starts the app and closes the console it opened; the uninstaller takes the folder off Path only if an installer added it, never an entry you had
Linux <name>-<version>-linux-<arch>.deb for Debian and Ubuntu, and <name>-<version>-linux-<arch>.pkg.tar.gz for Arch Linux, which install the app in /opt/<slug> with a command, links to its commands, its desktop entry and icon (the Arch package includes .MTREE for pacman -Qkk), and <name>-<version>-linux-<arch>.AppImage, which runs on any distribution without installing

-installers=false or build.installers: false builds the desktop apps without installers or store packages. To skip only selected desktop systems, list macos, windows or linux in build.skip_installers. The -skip-installers flag replaces that list with comma-separated names; -skip-installers= clears it.

Building a DMG mounts the disk image with hdiutil attach, which can be denied without a logged-in GUI session. On a headless Mac, use -skip-installers=macos or set build.skip_installers: [macos] to keep the signed .app and still build the Windows and Linux installers.

The Windows setup and uninstaller build with Go alone, on any system, and use native Windows dialogs. They speak the languages of the app’s catalogs they have words for, Simplified and Traditional Chinese included, picking the system’s UI language; /LANG=<LCID> picks one for a single run, such as /LANG=2052 for Simplified Chinese. /S installs or uninstalls silently, a final /D=<folder> chooses the folder, spaces included, and /RELAUNCH opens the app after an update. Without /D, an upgrade installs in the folder of the installation it replaces.

The installers take pictures and icons of the app’s own; each is the app’s icon or the built-in picture otherwise:

macos:
dmg_background: assets/DMGBackground.png # the disk image's window, which takes its size in points
dmg_icon: assets/DMGIcon.png # the disk image's icon: an .icns or a square PNG
windows:
installer_icon: assets/Setup.png # the setup program's icon: an .ico or a square PNG
uninstaller_icon: assets/Uninstall.png # the uninstaller's

A background PNG with a twin twice its size, such as DMGBackground@2x.png, stays sharp on Retina screens. The app’s icon sits a quarter in from the left, Applications a quarter in from the right, each with its name centered from top to bottom, where the built-in picture draws its arrow; leave room for them in a background of your own. The Linux packages have no pictures of their own; they install the app’s icon.

The Linux packages also install the app’s AppStream metadata, /usr/share/metainfo/<id>.metainfo.xml, by which software centers list it, written from linux.summary, linux.license, if set, and the app’s names, with Utility as its category when linux.categories names none; the AppImage holds it in its AppDir’s usr/share, beside a link to its desktop entry in usr/share/applications, which the metadata names. Files the system reads from /usr/share, such as richer metadata, more desktop entries, shell completions or manual pages, go in the directory linux.share names, relative to nsgo.yaml: the .deb and Arch package install its tree under /usr/share, and the AppImage under its AppDir’s usr/share. Its metainfo/<id>.metainfo.xml replaces the one NSGo writes, and a file at a path the package writes itself, such as the app’s desktop entry or icon, fails the build. Files in resources/, however named, stay beside the executable in /opt/<slug>, and store builds’ Flatpaks take NSGo’s metadata alone.

The AppImage needs FUSE, which most distributions have, and takes GTK 4 from the system, as the packages do; its runtime is downloaded once into the user cache.

AppImages embed a gh-releases-zsync locator using release.github or the GitHub remote origin, selecting the latest stable release and this app’s architecture. Upload each .AppImage with its generated .AppImage.zsync file. For another host, set linux.appimage_update to zsync|https://example.com/latest.AppImage.zsync, a stable URL served with HTTP range support; it also accepts gh-releases-zsync|owner|repo|latest-pre|name-*-linux-x64.AppImage.zsync for a prerelease channel. An explicit empty string disables embedded discovery; without a GitHub repository or a configured locator it is empty too. The .zsync file is still generated, separately from the signed appcast.

An app can ship command-line programs beside its desktop executable, such as a CLI working on the app’s data. List them under commands, each built from a Go main package:

commands:
- name: hello-cli # the file's name, hello-cli.exe on Windows
package: ./cmd/hello-cli # a main package, built for each desktop target with CGO_ENABLED=0 and build.tags
ldflags: [-X main.channel=beta] # its own linker flags, after build.ldflags
windows:
path: true # the installer puts the app's folder on the user's Path

A name is letters, digits, - and _, and may not be the app’s executable, its Linux command, Uninstall, AppRun or another command’s in any case. macos_universal joins the two macOS builds of each command, as it joins the app’s.

A package links with build.ldflags and -ldflags, then its own ldflags, whose -X values win, then the app’s identity, so core.App() gives the command the name, ID, version and build number of nsgo.yaml, as it gives the app. A command that does not import core takes the version with -X, such as -ldflags "-X main.version=1.2.0" on build, which the app and its commands both take.

Package Commands
macOS In Contents/MacOS, signed before the app as it is, as <id>.<command>: ad hoc, or with sign.identity, the hardened runtime and a timestamp, so the app notarizes, but without the app’s entitlements. The disk image puts nothing on PATH; the Homebrew cask links each command, and a user may link /Applications/<name>.app/Contents/MacOS/<command> themselves
Windows <command>.exe beside <name>.exe, signed as it is, which the installer installs and its uninstaller removes; with windows.path the installer also puts the folder on the user’s Path, as windows.command_line does, so consoles opened after installing find the commands. A command an update renames or drops stays in the folder, as a file the app no longer ships does, since the uninstaller removes only what its version installed
Linux In /opt/<slug> with a /usr/bin/<command> link that the .deb and Arch package own, so removing the package removes it, and dpkg and pacman refuse to install over another package’s; the AppImage holds them beside the app and puts nothing on PATH

The installers, their checksums and the update appcasts carry the commands as they carry the app’s other files, so an update replaces them with the app. Store packages leave them out, as the Mac App Store’s sandbox, the MSIX and the Flatpak run only the app’s own executable.