Skip to main content
The sign command allows you to digitally sign your built Native Desktop applications for Windows and macOS. Code signing is essential for ensuring user trust, preventing security warnings, and meeting platform distribution requirements.

Prerequisites

Before signing your application, ensure:
  • Your application has been built using native-desktop build
  • You have valid code signing certificates for your target platform
  • You have the necessary credentials and identities configured
Code signing requires platform-specific certificates and credentials. Unsigned applications may trigger security warnings or be blocked by operating systems.

Basic Usage

To sign an application, run:
If you don’t specify an app path, the CLI will attempt to detect the application automatically from the bin/ directory.

Command Options

[app-path] (Optional)

Path to the application to sign.
  • Type: String (positional argument)
  • Required: No (auto-detected if not provided)
  • Example: bin/MyApp.dmg, bin/MyApp.exe

--platform

Target platform for signing.
  • Type: String
  • Choices: windows, mac
  • Required: No (auto-detected from app path)

--verbose

Enable verbose logging for detailed signing information.
  • Type: Boolean
  • Default: false

macOS Signing

Signing macOS applications requires an Apple Developer certificate and optionally Apple ID credentials for notarization.

Required Credentials

  • Developer ID Application Certificate: For signing the application
  • Apple ID (optional): For notarization
  • Team ID (optional): For notarization

macOS Options

--identity

Certificate identity name or hash for signing.
  • Type: String
  • Required: Yes (for macOS)
  • Format: Certificate name or SHA-1 hash
To find your certificate identity, use: security find-identity -v -p codesigning

--apple-id

Apple ID email address for notarization.
  • Type: String
  • Required: No (required for notarization)

--apple-id-password

Apple ID app-specific password for notarization.
  • Type: String
  • Required: No (required for notarization)
Generate an app-specific password at appleid.apple.com. Never use your main Apple ID password.

--team-id

Apple Team ID for notarization.
  • Type: String
  • Required: No (required for notarization)

macOS Examples

Basic Signing (No Notarization)

Signing with Notarization

Using Certificate Hash

macOS Notarization

Notarization is an additional security step required for distribution outside the Mac App Store. It involves:
  1. Signing: Application is signed with Developer ID
  2. Upload: Binary is uploaded to Apple for scanning
  3. Verification: Apple verifies the application
  4. Stapling: Notarization ticket is attached to the application
Notarization is required for macOS 10.15+ applications distributed outside the Mac App Store.

Windows Signing

Signing Windows applications requires a code signing certificate in .pfx or .p12 format.

Required Credentials

  • Code Signing Certificate: .pfx or .p12 file
  • Certificate Password: Password for the certificate file

Windows Options

--cert-file

Path to the certificate file (.pfx or .p12).
  • Type: String
  • Required: Yes (one of cert-file or certificate-sha1)

--cert-password

Password for the certificate file.
  • Type: String
  • Required: Yes (when using cert-file)
Never commit certificate passwords to version control. Use environment variables or secure secret management.

--cert-subject-name

Certificate subject name (alternative to cert-file).
  • Type: String
  • Required: No

--certificate-sha1

Certificate SHA1 hash (alternative to cert-file).
  • Type: String
  • Required: No

Windows Examples

Signing with Certificate File

Signing with Certificate Store

Signing with SHA1 Hash

Signing MSI Installer

Automatic Signing During Build

You can automatically sign your application during the build process using the --sign flag:
When using --sign with the build command, signing credentials must be configured in your native-desktop.config.json5 file.

Configuration File Signing

You can configure signing credentials in your native-desktop.config.json5 file:
Use environment variables for sensitive credentials like passwords.

Verification

After signing, verify your application:

macOS Verification

Windows Verification

Common Issues

Error: Certificate identity not foundSolution: Ensure your Developer ID certificate is installed in Keychain.
Error: Notarization failedSolution: Check that all credentials are correct and the app-specific password is valid.
  • Verify Apple ID credentials
  • Ensure app-specific password is generated
  • Check Team ID matches your developer account
  • Review verbose logs with --verbose
Error: Invalid certificate passwordSolution: Verify the certificate password is correct.
Error: Certificate file not foundSolution: Provide the correct path to the certificate file.
Error: Application path not foundSolution: Ensure the application has been built and the path is correct.

Security Best Practices

Secure Credentials

Never commit certificates or passwords to version control. Use environment variables or secret management tools.

App-Specific Passwords

Use Apple app-specific passwords instead of your main Apple ID password for notarization.

Certificate Protection

Store certificate files securely and restrict access to authorized personnel only.

Regular Renewal

Monitor certificate expiration dates and renew before expiry to avoid distribution issues.

Platform Requirements

macOS

  • macOS 10.13+: Required for code signing
  • Xcode Command Line Tools: Install with xcode-select --install
  • Apple Developer Account: Required for Developer ID certificates
  • Internet Connection: Required for notarization

Windows

  • Windows 7+: Supported for code signing
  • signtool: Included in Windows SDK
  • Code Signing Certificate: From trusted Certificate Authority

CI/CD Integration

GitHub Actions Example