160 lines
3.1 KiB
Text
160 lines
3.1 KiB
Text
---
|
|
title: Creating Installers
|
|
description: Package your application for distribution
|
|
sidebar:
|
|
order: 3
|
|
---
|
|
|
|
import { Tabs, TabItem } from "@astrojs/starlight/components";
|
|
|
|
## Overview
|
|
|
|
Create professional installers for your Wails application on all platforms.
|
|
|
|
## Platform Installers
|
|
|
|
<Tabs syncKey="platform">
|
|
<TabItem label="Windows" icon="seti:windows">
|
|
### NSIS Installer
|
|
|
|
```bash
|
|
# Install NSIS
|
|
# Download from: https://nsis.sourceforge.io/
|
|
|
|
# Create installer script (installer.nsi)
|
|
makensis installer.nsi
|
|
```
|
|
|
|
**installer.nsi:**
|
|
```nsis
|
|
!define APPNAME "MyApp"
|
|
!define VERSION "1.0.0"
|
|
|
|
Name "${APPNAME}"
|
|
OutFile "MyApp-Setup.exe"
|
|
InstallDir "$PROGRAMFILES\${APPNAME}"
|
|
|
|
Section "Install"
|
|
SetOutPath "$INSTDIR"
|
|
File "build\bin\myapp.exe"
|
|
CreateShortcut "$DESKTOP\${APPNAME}.lnk" "$INSTDIR\myapp.exe"
|
|
SectionEnd
|
|
```
|
|
|
|
### WiX Toolset
|
|
|
|
Alternative for MSI installers.
|
|
</TabItem>
|
|
|
|
<TabItem label="macOS" icon="apple">
|
|
### DMG Creation
|
|
|
|
```bash
|
|
# Create DMG
|
|
hdiutil create -volname "MyApp" -srcfolder build/bin/MyApp.app -ov -format UDZO MyApp.dmg
|
|
```
|
|
|
|
### Code Signing
|
|
|
|
```bash
|
|
# Sign application
|
|
codesign --deep --force --verify --verbose --sign "Developer ID" MyApp.app
|
|
|
|
# Notarize
|
|
xcrun notarytool submit MyApp.dmg --apple-id "email" --password "app-password"
|
|
```
|
|
|
|
### App Store
|
|
|
|
Use Xcode for App Store distribution.
|
|
</TabItem>
|
|
|
|
<TabItem label="Linux" icon="linux">
|
|
### DEB Package
|
|
|
|
```bash
|
|
# Create package structure
|
|
mkdir -p myapp_1.0.0/DEBIAN
|
|
mkdir -p myapp_1.0.0/usr/bin
|
|
|
|
# Copy binary
|
|
cp build/bin/myapp myapp_1.0.0/usr/bin/
|
|
|
|
# Create control file
|
|
cat > myapp_1.0.0/DEBIAN/control << EOF
|
|
Package: myapp
|
|
Version: 1.0.0
|
|
Architecture: amd64
|
|
Maintainer: Your Name
|
|
Description: My Application
|
|
EOF
|
|
|
|
# Build package
|
|
dpkg-deb --build myapp_1.0.0
|
|
```
|
|
|
|
### RPM Package
|
|
|
|
Use `rpmbuild` for RPM-based distributions.
|
|
|
|
### AppImage
|
|
|
|
```bash
|
|
# Use appimagetool
|
|
appimagetool myapp.AppDir
|
|
```
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
## Automated Packaging
|
|
|
|
### Using GoReleaser
|
|
|
|
```yaml
|
|
# .goreleaser.yml
|
|
project_name: myapp
|
|
|
|
builds:
|
|
- binary: myapp
|
|
goos:
|
|
- windows
|
|
- darwin
|
|
- linux
|
|
goarch:
|
|
- amd64
|
|
- arm64
|
|
|
|
archives:
|
|
- format: zip
|
|
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
|
|
|
|
nfpms:
|
|
- formats:
|
|
- deb
|
|
- rpm
|
|
vendor: Your Company
|
|
homepage: https://example.com
|
|
description: My Application
|
|
```
|
|
|
|
## Best Practices
|
|
|
|
### ✅ Do
|
|
|
|
- Code sign on all platforms
|
|
- Include version information
|
|
- Create uninstallers
|
|
- Test installation process
|
|
- Provide clear documentation
|
|
|
|
### ❌ Don't
|
|
|
|
- Don't skip code signing
|
|
- Don't forget file associations
|
|
- Don't hardcode paths
|
|
- Don't skip testing
|
|
|
|
## Next Steps
|
|
|
|
- [Auto-Updates](/guides/auto-updates) - Implement automatic updates
|
|
- [Cross-Platform Building](/guides/cross-platform) - Build for multiple platforms
|