Check your computer
Turf runs on four kinds of computer. Find yours in the table:
| Computer | Notes |
|---|---|
| Linux x86-64 | Needs glibc 2.34 or newer: Ubuntu 22.04, Debian 12, RHEL 9, Amazon Linux 2023 and later. |
| Linux arm64 | 64-bit ARM. Needs glibc 2.34 or newer, like x86-64. |
| Windows x86-64 | Runs natively. No MSYS2 or other toolchain to install. |
| macOS arm64 | Macs with Apple Silicon. Intel Macs are not supported. |
Run the installer
Open a terminal and pick the tab for your computer. Copy the command (use the button in the corner), paste it into the terminal and press Enter.
curl -fsSL https://turflang.org/install.sh | shThis downloads the installer with curl and runs it with sh. Turf goes into a folder called .turf inside your home folder, written ~/.turf for short.
curl -fsSL https://turflang.org/install.sh | shThe same command as on Linux. Open the Terminal app (press ⌘ + Space and type “Terminal”), paste the line and press Enter. Turf goes into ~/.turf.
irm https://turflang.org/install.ps1 | iexRun this in PowerShell (search for it in the Start menu). Turf goes into %LOCALAPPDATA%\turf.
What the installer does
It’s a good habit to know what a command does before you run it. The installer prints each step as it goes. On Linux and macOS there are five:
Looks up the release
Finds the newest version of Turf, and the download made for your kind of computer.
Downloads the archive
An archive is lots of files packed into one, like a zip file.
Checks the download
Compares the download’s SHA-256 fingerprint with the one the release lists. If they don’t match, or the check can’t run, it stops and installs nothing. This catches a broken or cut-short download.
Unpacks it
Opens the archive into
~/.turf.Checks the compiler starts, and adds it to your PATH
Makes sure
turfreally runs. Then it adds one clearly marked block to your shell’s start-up file, so theturfcommand works in every new terminal.
The Windows installer does the same job in four steps, and adds Turf to your user PATH instead of a start-up file. When they finish, both suggest something to try: turf new hello, then cd hello, then turf run.
What is PATH?
When you type a command like turf, the terminal has to find the program with that name. It looks through a list of folders called the PATH, one after another, like checking the shelves of a library in order. The installer adds Turf’s bin folder, where the turf program lives, to that list.
- you type turfin a terminal
- the terminal searches PATHfolder by folder
- ~/.turf/bin/turffound it: run it
Check it works
In your new terminal, type:
turf versionYou should see something like this. Your version numbers and folders will be your own:
$ turf version turf 1.0.0 (needs turfc interface 1.1+) turfc 2.0.0 (interface 1.7, /opt/turf/bin/turfc) llvm 22.1.8 runtime turf_rt_abi_2_0 root /opt/turf linker system-cc smart built-in
There are two version numbers because Turf is really two programs working as a team:
- turf
The command you type. It understands projects, runs your tests and drives the compiler for you.
- turfc
The compiler itself, which does the translating. You never need to type it:
turffinds it and runs it for you.
If turf version printed its versions, you’re ready: in the next guide you’ll write your first program and run it.
If something goes wrong
“turf: command not found”
The terminal can’t find turf on its PATH. Try these, in order:
- Close the terminal and open a new one. This fixes it almost every time.
- On Linux or macOS, to use Turf in the terminal you already have open, run the line the installer printed at the end. For the usual folder it is
export PATH="$HOME/.turf/bin:$PATH". - The installer knows the zsh, bash and fish shells. If you use a different one, it tells you which file it put the PATH line in. If your shell doesn’t read that file, add
~/.turf/binto your PATH yourself.
Other problems
| What you see | What it means |
|---|---|
| A SHA-256 mismatch | The download was damaged or cut short, and nothing was installed. Run the command again. |
| An error about glibc on Linux | The Linux downloads need glibc 2.34 or newer. You can build Turf from source instead. |
| You have an Intel Mac | Intel Macs are not supported. Only Macs with Apple Silicon are. |
Installer options
Most people never need these. The installer takes a few options:
| Linux and macOS | Windows | What it does |
|---|---|---|
--version v2.0.0 |
-Version |
Installs a release other than the latest. |
--prefix DIR |
-Prefix |
Installs into another folder. |
--smart |
-Smart |
Installs the -smart build (see below). |
--no-modify-path |
-NoModifyPath |
Leaves start-up files alone, and prints the line to add yourself. |
--uninstall |
-Uninstall |
Removes Turf. |
To use an option on Linux or macOS, save the installer to a file first, then run it with the options you want:
curl -fsSL https://turflang.org/install.sh -o install.shsh install.sh --version v2.0.0 --prefix ~/tools/turfA piped irm | iex on Windows can’t take options either. Set the environment variables TURF_INSTALL_VERSION, TURF_INSTALL_DIR or TURF_INSTALL_SMART=1 first, or save the script and run it with the options above.
Uninstalling
Run the installer again with --uninstall (on Windows, -Uninstall). It removes exactly what it added, and never touches your projects, the package cache, or a model you put in models/.
Other ways to install
By hand
Download the archive for your computer from the Download page, unpack it anywhere, and run bin/turf, or put the bin/ folder on your PATH. The archive is a single folder:
- bin/the programs:
turfandturfc - lib/the runtime and the standard library
- docs/the documentation
- share/turf/examples/example programs
There’s nothing else to set up. The compiler finds lib/ by looking next to itself, even through shortcuts (symlinks).
The -smart build
Every release comes in two flavours: the plain one, and a -smart one. The smart build is the same compiler plus what --smart needs. --smart is an optional helper: when the compiler finds an error it can’t fix by itself, it asks a small language model (a kind of AI) running on your own computer to suggest a fix. Turf only shows a suggestion after checking that it really removes the error. No model is included or downloaded: you choose one and put it in the models/ folder of your install.
From source
You can also build Turf from its source code. You need LLVM 22, CMake 3.20 or newer and a C++20 compiler (Clang is recommended), plus Go 1.26 or newer for the turf command.
git clone --recursive https://github.com/turf-lang/turf-langcd turf-lang./scripts/cmake_build.sh --release./scripts/install/dev_install.shThe last line links turf into ~/.local/bin. The README lists every option.