Triple

Build static Linux binaries on your Mac.
Use the Swift library, CLI, or native app.

Triple 0.2.0. Apple silicon. macOS 26.5 or later.

Strips a copy of the executable and verifies it again. Resource bundles are preserved. Export the executable and resource bundles together. The destination must be new and its parent directory must exist.
import Foundation
import Triple

let result = try await Triple.build(
    URL(filePath: "./MyServer"),
    for: .linux(.arm64)
)

print(result.executable.path)

MyServer

Target
Linux ARM64
Build
Release
Linking
Static · Musl
Executable
Unstripped
Output
.build/

Swift library

One line of Swift.

Add Linux builds to your own Swift tools.

Add the package.

In Package.swift, add Triple to your dependencies, then add its library product to your target.

Package dependency
.package(
    url: "https://github.com/mottzi/Triple.git",
    from: "0.7.0"
)
Target dependency
.product(
    name: "Triple",
    package: "Triple"
)

Build a verified Linux executable from your package directory.

Swift
import Foundation
import Triple

let package = URL(filePath: ".")
let result = try await Triple.build(package)

print(result.executable.path)

Defaults to x86-64 Linux and release mode. Installs missing build tools and resolves dependencies.

Before you build

On your Mac

Apple silicon, macOS 13+, and Xcode or Command Line Tools with Swift 6.3+. Run library callers outside the App Sandbox.

In your package

Your executable and dependencies must support Linux Musl. Build packages you trust; SwiftPM can run manifests and plugins.

TripleCLI For your terminal.

Build and export from your terminal. Get JSON results for scripts and CI.

Install from source.

For Apple silicon Macs with macOS 13+ and Swift 6.3+.

Terminal
git clone https://github.com/mottzi/TripleCLI.git
cd TripleCLI
git checkout 0.3.0
./install.sh

Installs triple in ~/.local/bin and adds it to your shell's PATH.

Build and export.

Choose ARM64 Linux and an output directory.

Terminal
triple build ./MyServer \
  --architecture aarch64 \
  --output-path ./MyServer-linux \
  --install-environment \
  --resolve-dependencies

Example output

MyServer-linux/

Verified static ARM64 executable and required resources.

The flags permit installing build tools and resolving dependencies. Add --json for one machine-readable result.

TripleApp Simple and native.

Build static Linux executables from your Swift packages. Choose the settings. Triple handles the build.

Drop it in.
Build it here.

Drop in a Swift package. Triple finds its products and installed Swift tools.

Pick your Linux target. Follow the build as it happens.

One export.
Ready for Linux.

Your executable and its resource bundles, together. Export the finished build or open it in Finder.

Triple’s Build files popover showing the finished executable and the Export Build and Show in Finder actions.

For Apple silicon Macs with macOS 26.5 or later.