Skip to content
mutastic

Swift edition

Installing mutastic

The Swift edition runs where your tests run: on macOS and on Linux. It isn’t released yet, so today you build it from its source and install it with one command. From 1.5.0, the mutastic command the other editions install runs it for you, and fetches it the first time.

  • Swift 6.0 or later. On macOS that’s Xcode 16 or later, with xcode-select pointing at it; on Linux, a toolchain from swift.org. The site finder needs 6.0 to build, and a checkout’s just run stops before building with an older one.
  • To build it from source: rustup, which installs the Rust toolchain the repository pins the first time it’s used, and just 1.59.0 or later.

There’s no Windows build: the Swift edition runs on macOS and Linux.

Terminal window
git clone https://github.com/mutastic/mutastic-swift.git
cd mutastic-swift
just install

just install builds two programs, each in release mode: mutastic-swift, the engine and the command, and synsites, the site finder that reads your Swift with SwiftSyntax. It packs them as target/package/mutastic-swift-<version>-<os>-<arch>.tar.gz, the shape a release’s download has, and puts what’s in it in ~/.mutastic/swift-<version>/ (or under MUTASTIC_HOME, when that’s set):

~/.mutastic/swift-1.5.0/
mutastic-swift
synsites
LICENSE NOTICE README.md

mutastic-swift looks for synsites beside itself, following a link to it, so you can link it onto your PATH. On Linux the site finder is built with the Swift runtime inside it, so it runs whichever Swift your project uses.

Check it’s there:

Terminal window
~/.mutastic/swift-1.5.0/mutastic-swift --version
Terminal window
mutastic-swift 1.5.0

From 1.5.0, mutastic, the command the Java and Rust editions install, decides which edition to run from the directory it’s given: a Package.swift, an .xcodeproj or an .xcworkspace makes it a Swift project, and it runs the Swift edition in ~/.mutastic/swift-<version>/, the newest of its own major and minor version, else the newest there. It hands the edition the command as it was typed, so its output and exit status are the edition’s. MUTASTIC_SWIFT_ENGINE names one to run instead, such as one built in a checkout.

Also from 1.5.0, each release of the Swift edition is on its releases page, tagged v<version>: an archive for each machine, mutastic-swift-<version>-<os>-<arch>.tar.gz, with SHA256SUMS beside them. When none is installed, mutastic fetches the one for your machine the first time it meets a Swift project, checks it against SHA256SUMS, and unpacks it into ~/.mutastic/swift-<version>/, as it fetches the Java edition.

Until then, the released mutastic doesn’t know a Swift project from any other directory, and says there’s no project to test. Run the Swift edition by its own name: it takes the same words.

Terminal window
~/.mutastic/swift-1.5.0/mutastic-swift run samples/pricing

In a checkout, just run checks the toolchains, builds the site finder and the engine, and runs them on samples/pricing, or on the package you name; just run explain <id> runs another command. MUTASTIC_SWIFT_SYNSITES names a site finder that isn’t beside the command, as a build in the checkout’s target/debug has none beside it.