Install.

Silk installs with one script: a shell script on macOS and Linux, and a PowerShell script on Windows (see Install on Windows). It downloads a release of Silk, the silkc compiler and its standard library, into ~/.silk, as one version among any others you install later, and installs silk, the command you type. silk runs each project with the Silk version it pins. Each release carries its own LLVM (Clang, LLD and llvm-ar), so building programs needs nothing else installed.

shell
curl -fsSL https://raw.githubusercontent.com/silk-lang/silk/main/install.sh | sh

The script needs curl, tar, uname, mktemp, cmp, ln, and sha256sum or shasum. Every Linux distribution and macOS has them.

Supported hosts#

HostRelease target
macOS on Apple siliconaarch64-apple-darwin
macOS on Intelx86_64-apple-darwin
Linux on x86-64x86_64-unknown-linux-gnu
Linux on ARM64aarch64-unknown-linux-gnu
Windows on x86-64x86_64-pc-windows-msvc

Intel Mac builds start with v0.1.0-dev.45+256a8b0335d5. Other systems stop with a line such as silk-install: Silk has no build for Linux on riscv64 yet. A shell running under Rosetta on an Apple silicon Mac is detected, and gets the Apple silicon build; only a real Intel Mac gets the Intel one.

Windows builds start with v0.1.0-dev.41+b10165a17baa and install with install.ps1 instead of install.sh. Windows on ARM64 is not supported yet; the PowerShell script stops with This release requires Windows x86_64.

What the script does#

On Linux x86-64 a run looks like this:

TEXT
Downloading silk-0.1.0-x86_64-unknown-linux-gnu.tar.gz from v0.1.0
######################################################################## 100.0%
minisign is not installed; skipping the signature check of silk-0.1.0-x86_64-unknown-linux-gnu.tar.gz

Installed silk v0.1.0 to /home/you/.silk/toolchains/0.1.0
It is the default Silk version. Installed the silk tool to /home/you/.silk/bin/silk.
silk runs each project with the Silk version it pins: silk build, silk test, silk run.
Update the tool with: silk update self

Add Silk to your PATH by adding this line to ~/.bashrc:

  export PATH="/home/you/.silk/bin:$PATH"

Step by step, the script:

  1. Picks a release from GitHub. It prefers the newest stable release. Before the first stable release exists, it takes the newest published dev release. No stable release is published yet, so today the script installs the newest dev release, such as v0.1.0-dev.31+2fc1811f535e.

  2. Downloads silk-<version>-<target>.tar.gz for your host.

  3. Checks the archive's minisign signature, when minisign is installed (see below).

  4. Checks that the compiler bin/silkc has the SHA-256 the release publishes in native-seed.json, that it reports the requested version, and that its bundled change snapshot matches the release's changes-snapshot.toml.

  5. Moves the release into ~/.silk/toolchains/<version>, replacing an earlier install of the same version, and makes it the default in ~/.silk/settings.toml, keeping an auto-install line already there. Other versions stay installed.

  6. Moves the release's bin/silk, the tool, to ~/.silk/bin/silk, after checking that it runs the installed compiler. The toolchain keeps only the compiler.

  7. Checks your PATH, and prints what to fix.

Any failed check stops the script with a silk-install: message on standard error, and nothing is installed.

What lands in ~/.silk:

TEXT
~/.silk/
  bin/silk                                  the silk tool, the command you type
  settings.toml                             default = "0.1.0"
  toolchains/0.1.0/
    bin/silkc                               the compiler
    lib/silk/stdlib/                        the standard library, in source
    lib/silk/changes-snapshot.toml          the change history this compiler was built from
    lib/silk/llvm/                          the LLVM that builds programs: Clang, LLD and llvm-ar

Builds add ~/.silk/git/ later, with one folder per commit of the git dependencies they fetch. See Dependencies.

The compiler finds its standard library at ../lib/silk/stdlib, next to its own bin folder, so keep each version's two folders together. ~/.silk/bin/silk is not a compiler: it runs the silkc of the version the directory selects. The compilers stay off your PATH on purpose, so that every command goes through the version a project pins.

Settings#

The script reads these environment variables. Set them on sh, not on curl:

shell
curl -fsSL https://raw.githubusercontent.com/silk-lang/silk/main/install.sh | SILK_HOME=/opt/silk sh
VariableMeaningDefault
SILK_HOMEFolder that holds the Silk versions, bin/silk, settings.toml and the git checkouts of git dependencies~/.silk
SILK_RELEASEAn exact release tag to install, such as v0.1.0The newest release
SILK_CHANNELstable, dev or auto. auto prefers stable and falls back to dev only before any stable release exists. dev takes the newest published dev release even after a stable one existsauto
GITHUB_TOKENOptional. Raises the GitHub API rate limit, useful on shared CI machinesnone

SILK_RELEASE pins a version, which is what you want in CI. A tag that does not exist stops the script with silk-install: silk-lang/silk has no release v9.9.9. Dev tags carry a commit, as in v0.1.0-dev.3+fbd34fb3d0ee; quote them in the shell.

SILK_CHANNEL=stable refuses to fall back while no stable release exists:

TEXT
silk-install: silk-lang/silk has no stable compiler release yet; use SILK_CHANNEL=dev or SILK_RELEASE

Any other channel name stops with silk-install: SILK_CHANNEL must be auto, stable, or dev.

LLVM and Clang#

Silk compiles your code to LLVM bitcode and hands it to Clang to make the executable. A release keeps its own LLVM 23 at lib/silk/llvm, beside the compiler: one llvm executable that is Clang, LLD and llvm-ar, for x86-64, ARM64 and WebAssembly. The first build makes the links Clang runs it by (clang, ld.lld, ld64.lld, wasm-ld, lld-link, llvm-ar and llvm-dlltool) in lib/silk/llvm/bin. A release installed by the script, by Homebrew, by mise or by unpacking the archive by hand works the same way. You do not install Clang yourself.

The compiler uses the Clang named by --clang <path> on silk build, silk run or silk test, else the one named by the SILK_CLANG environment variable, else the bundled Clang, else the first clang on your PATH. Another Clang must be 22 or newer. The archiver comes from SILK_LLVM_AR, or else the llvm-ar in the same folder as the Clang in use.

On Linux, an executable links with the ld.lld in Clang's installation directory when there is one, which is faster than the system linker. The bundled Clang has one beside it. The progress row reads link clang either way.

On macOS, a plain program links with no SDK. A package with C sources or native libraries needs the macOS SDK, found through xcrun, else at /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk, else at Xcode's default SDK. With none, the build stops and says to install the Command Line Tools with xcode-select --install or to set SDKROOT to an SDK directory.

A build with a Clang older than 22 stops at the link step and names the Clang it found:

TEXT
Compiling hello (x86_64-unknown-linux-gnu, dev)
  load      166 modules, 1 in package         0.03s
  check     1 module                          0.00s
  codegen   387 functions                     0.14s
  borrow    253 bodies                        0.00s
silk: Silk builds need Clang 22 or newer, but /usr/bin/clang (from SILK_CLANG) is Clang 18; set SILK_CLANG or pass --clang the path of a newer Clang
  link      failed                            0.86s
Failed hello in 1.07s

If the chosen Clang cannot start, for example because SILK_CLANG names a file that does not exist, the message names the path and where it came from: from SILK_CLANG, from --clang or found on PATH.

TEXT
silk: cannot run the C compiler /nope/clang (from SILK_CLANG); set SILK_CLANG or pass --clang the path of the Clang executable

A compiler with no bundled LLVM beside it, such as one you built yourself, and no clang on your PATH, stops with silk: cannot find clang on PATH; set SILK_CLANG or pass --clang the path of the Clang executable. All three failures exit with status 2.

Add silk to your PATH#

The script does not edit your shell profile. When ~/.silk/bin is not on your PATH, it prints the line to add and the file to add it to: ~/.zshrc for zsh, ~/.bashrc for bash on Linux, ~/.bash_profile for bash on macOS.

shell
export PATH="$HOME/.silk/bin:$PATH"

Open a new terminal, or source the profile, and check that silk answers with the version it selects:

shell
silk --version
TEXT
silk v0.1.0

Verify the signature#

Each release archive is signed with minisign. Install minisign (from your package manager) before you run the script, and the script checks the signature for you:

TEXT
Downloading silk-0.1.0-x86_64-unknown-linux-gnu.tar.gz from v0.1.0
Verified the minisign signature of silk-0.1.0-x86_64-unknown-linux-gnu.tar.gz

When minisign is installed, a missing or wrong signature stops the install. The signature's trusted comment must also read silk <tag> <archive name>, so a signature from another release or another file is rejected.

The Silk release public key is:

TEXT
RWQefAo9Dbb8LrlLPaqWdRNlX5th2l7r+4WYhxRNbe5K5URDUht1XUDs

It is built into install.sh and also published as minisign.pub at the root of the silk repository.

Install from a release archive by hand#

You can skip the script. Each release on the silk-lang/silk GitHub releases page has one archive per target, with a .minisig signature beside it.

Download silk-<version>-<target>.tar.gz and its .minisig for your host, then verify it:

shell
minisign -Vm silk-0.1.0-x86_64-unknown-linux-gnu.tar.gz -P RWQefAo9Dbb8LrlLPaqWdRNlX5th2l7r+4WYhxRNbe5K5URDUht1XUDs
TEXT
Signature and comment signature verified
Trusted comment: silk v0.1.0 silk-0.1.0-x86_64-unknown-linux-gnu.tar.gz

Unpack it. The archive holds one folder, silk-<version>-<target>/, with bin/silk (the tool), bin/silkc (the compiler) and lib/silk/ inside:

shell
tar -xzf silk-0.1.0-x86_64-unknown-linux-gnu.tar.gz

Move its bin/silk to ~/.silk/bin/silk, then move the unpacked folder to ~/.silk/toolchains/<version>, named by the version without the leading v, and silk use list finds it. Or keep bin and lib together anywhere else you like and put that bin on your PATH: with no version selected, silk runs the silkc beside it.

When you save a release asset with curl -O, the + in a dev version stays encoded as %2B in the file name. Use curl -o <name> to choose the name yourself.

Install on Windows#

On Windows x86-64, run this in PowerShell:

powershell
irm https://raw.githubusercontent.com/silk-lang/silk/main/install.ps1 | iex

The script needs no administrator privileges and no Windows SDK or Visual Studio: Silk programs on Windows call the system DLLs directly, with no C runtime. It installs into %USERPROFILE%\.silk, with the same layout as on macOS and Linux:

TEXT
%USERPROFILE%\.silk\
  bin\silk.exe                              the silk tool, the command you type
  settings.toml                             default = "0.1.0-dev.41+b10165a17baa"
  toolchains\0.1.0-dev.41+b10165a17baa\
    bin\silkc.exe                           the compiler
    lib\silk\stdlib\                        the standard library, in source

It picks a release the same way as install.sh, and reads the same settings from environment variables. Set them in the session before you run the script:

powershell
$env:SILK_HOME = 'D:\silk'
$env:SILK_RELEASE = 'v0.1.0-dev.41+b10165a17baa'
irm https://raw.githubusercontent.com/silk-lang/silk/main/install.ps1 | iex

Before it runs anything it downloaded, the script checks the ZIP's SHA-256 against GitHub's asset metadata, and the minisign signature when minisign is on PATH. Then it checks that bin\silkc.exe has the SHA-256 in native-seed.json, reports the requested version, and carries the release's change snapshot, as install.sh does. A failed check stops the script and installs nothing.

The script does not change your PATH. Add %USERPROFILE%\.silk\bin (or the bin folder of your SILK_HOME) to your user Path in Windows' Environment Variables settings, then open a new terminal. To try it in the current PowerShell session only:

powershell
$env:Path = "$env:USERPROFILE\.silk\bin;$env:Path"
silk --version

LLVM on Windows#

The release carries its own LLVM at lib\silk\llvm, with lld-link and llvm-dlltool, so building programs needs nothing else installed. The compiler makes hard links to the llvm.exe there on first use, since a ZIP cannot hold links. To use another LLVM 22 or newer, point SILK_CLANG at its clang.exe:

powershell
$env:SILK_CLANG = 'C:\Program Files\LLVM\bin\clang.exe'

Scoop and mise#

Each release with Windows builds also publishes a Scoop manifest, silk.json, made from that release's ZIP and its SHA-256. Install it straight from the release, with the + of a dev tag written as %2B:

powershell
scoop install https://github.com/silk-lang/silk/releases/download/v0.1.0-dev.41%2Bb10165a17baa/silk.json

Scoop exposes both silk.exe and silkc.exe, and updates through a newer release's manifest. With mise, use its GitHub backend with the Windows ZIP:

toml
[tools."github:silk-lang/silk"]
version = "latest"
asset_pattern = "silk-{{ version }}-x86_64-pc-windows-msvc.zip"
strip_components = 1
bin_path = "bin"

This asset_pattern is for Windows only; leave it out on macOS and Linux. Until a stable release exists, add prerelease = true so mise sees dev releases.

By hand on Windows#

Each release has silk-<version>-x86_64-pc-windows-msvc.zip with a .minisig beside it, and the bare compiler as silk-compiler-x86_64-pc-windows-msvc.exe. The ZIP holds one folder, silk-<version>-x86_64-pc-windows-msvc\, with bin\silk.exe, bin\silkc.exe and lib\silk\. Unpack it, move bin\silk.exe to %USERPROFILE%\.silk\bin\silk.exe, and move the folder to %USERPROFILE%\.silk\toolchains\<version>, as on macOS and Linux. Verify the ZIP first with minisign -Vm <zip> -P <key>, using the key under Verify the signature.

Upgrade#

silk use latest installs the newest stable release beside the versions you have and makes it your default; silk use dev, or silk use latest --dev, takes the newest release of any kind, dev releases included. Until a stable release is published, silk use latest stops with exit status 1:

TEXT
silk: no stable Silk release is published yet; `latest --dev` names the newest dev release

silk update self updates the tool itself, to the newest stable release, or to the newest dev release while none is stable; --dev always takes the newest dev release. When there is nothing newer it says so:

TEXT
silk 0.1.0 is up to date (newest release: 0.1.0)

Running the script again does both. Add SILK_RELEASE to the script to install a specific version, older or newer. Installing a version you already have again with the script replaces its folder whole, so files from an old standard library do not linger. silk use list shows every installed version.

Switch versions#

Each package records the Silk version it runs with in silk.toml as silk-version. silk init writes your default version. Inside the package, silk hands every command to that version, so two projects on one machine can use different releases. A pin of 0.0.0 pins nothing.

Pin a version from inside a project with silk set. It also installs that version:

shell
silk set 0.1.0-dev.72
TEXT
Pinned Silk 0.1.0-dev.72+9c780a04d6ef in /home/you/app/silk.toml ([package].silk-version, was 0.1.0-dev.73+a4ea55e44e78)
Installed Silk 0.1.0-dev.72+9c780a04d6ef in /home/you/.silk/toolchains/0.1.0-dev.72+9c780a04d6ef
note: Silk 0.1.0-dev.72+9c780a04d6ef is older than this tool (0.1.0-dev.73+a4ea55e44e78); if it cannot read this silk.toml, pin a newer version or edit the manifest for it

silk set names the version it replaced, and warns when the new pin is older than the tool, since an older compiler may not read every key of a newer manifest. silk set <version> --no-install only edits the manifest.

After cloning someone's project, silk use alone installs the version it pins. When a project pins a version you do not have, its commands stop with exit status 3 and name the fix:

TEXT
silk: Silk 0.3.0 (package silk-version in /home/you/app/silk.toml) is not installed.
Install it with: silk use

Add auto-install = true to ~/.silk/settings.toml, or set SILK_AUTO_INSTALL=1, to have missing pinned versions installed when a command needs them. silk +<version> <command> runs one command with another installed version, and silk use <version> changes the version used outside projects. silk use checks the same signature and SHA-256 as the script, and needs no minisign. See "Silk versions" in the Command-line reference.

Uninstall#

Remove one version with silk use uninstall <version>. To remove Silk entirely, delete the install folder and remove the PATH line from your shell profile (on Windows, remove %USERPROFILE%\.silk and its bin entry from your user Path):

shell
rm -rf ~/.silk

The installer writes nothing outside that folder. Each package's own build/ folder holds its compiled output; silk clean removes it.

View the source of this page