Complete guide for installing and setting up the T programming language.
T requires the Nix package manager with flakes enabled. We strongly recommend using the Determinate Systems Nix Installer for its robustness and ease of use.
For detailed instructions on installing Nix on Linux, macOS, and Windows (WSL2), please see our dedicated:
Once Nix is installed and flakes are enabled, you can proceed to Step 2.
If you’re using the standard Nix installer (not the Determinate
Systems one), you might see an error that nix shell or
other commands are not recognized. You can enable the required features
by adding them to your Nix configuration or by appending a flag to each
command:
Option 1: Add to config (Recommended)
mkdir -p ~/.config/nix
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.confOption 2: Use a command flag Append
--extra-experimental-features "nix-command flakes" to your
Nix commands.
If you see warnings like ignoring untrusted substituter,
it means you need to add yourself as a trusted user so Nix allows you to
use the T binary cache. On macOS, you can run the following
one-liner:
echo "trusted-users = root $USER" | sudo tee -a /etc/nix/nix.custom.conf && sudo launchctl kickstart -k system/org.nixos.nix-daemonThis works for both standard Nix installations and Determinate Nix
installations. If you see warnings like
ignoring untrusted substituter, this means the
trusted-users configuration is not in place.
# Choose a directory for T (e.g., ~/projects)
mkdir -p ~/projects
cd ~/projects
# Clone the repository
git clone https://github.com/b-rodrigues/tlang.git
cd tlangThe Nix flake provides a complete, isolated development environment:
nix developFirst run will take several minutes to: - Download and compile OCaml toolchain - Build Apache Arrow and dependencies - Set up development tools (dune, menhir, etc.)
All dependencies are cached in the Nix store
(/nix/store/) and reused for future sessions.
Expected output:
warning: creating lock file '/home/user/projects/tlang/flake.lock'
...
(nix development shell activated)
Inside the development environment:
dune buildThis compiles: - Lexer and parser - Evaluator and runtime - Standard library packages - REPL
Expected output:
File "src/repl.ml", line 1, characters 0-0:
Building...
Build artifacts are placed in _build/default/.
dune exec src/repl.exeYou should see:
T, a reproducibility-first orchestration engine for polyglot
data science and statistical analysis.
Version 0.51.1 "Sangoku" using Nix <nix-version>
Licensed under the EUPL v1.2. No warranties.
This software is in beta and is entirely LLM-generated — caveat emptor.
Website: https://tstats-project.org
Contributions are welcome!
Type :quit or :q to exit, :help for commands.
T>
> 2 + 3
5
> [1, 2, 3] |> sum
6
> type(42)
"Int"
> exit
If all commands work, installation is successful! 🎉
Verify everything works correctly:
dune runtestExpected behavior: - All tests should pass - Golden tests compare T output against R results - Test execution may take 1-2 minutes
Every time you want to work with T:
cd ~/projects/tlang
nix developIf flake.nix changes (e.g., after pulling updates):
nix flake update
nix developdune clean
dune buildAutomatically enter the Nix shell when entering the directory:
# Install direnv
nix-env -iA nixpkgs.direnv
# Enable direnv in your shell (bash/zsh)
echo 'eval "$(direnv hook bash)"' >> ~/.bashrc # for bash
echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc # for zsh
# Create .envrc in tlang directory
cd ~/projects/tlang
echo "use flake" > .envrc
direnv allowNow cd tlang automatically activates the
environment.
T doesn’t yet have a public binary cache, but you can set one up locally for your team:
# In nix.conf
substituters = https://cache.nixos.org/ https://your-cache.example.com/
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=The Nix installation may not have updated your PATH. Try:
source ~/.nix-profile/etc/profile.d/nix.shOr restart your terminal.
Flakes aren’t enabled. Double-check
~/.config/nix/nix.conf:
cat ~/.config/nix/nix.conf
# Should contain: experimental-features = nix-command flakesNix is building dependencies from source. This is normal on first run. Check progress:
nix develop --show-traceOr use a faster binary cache (if available).
Clean and rebuild:
dune clean
rm -rf _build
dune buildIf errors persist, check: - You’re inside nix develop
shell - OCaml version: ocaml --version should be 4.14+ -
Dune version: dune --version should be 3.0+
T uses Apache Arrow C GLib bindings. If you see linking errors:
# Inside nix develop
pkg-config --modversion arrow-glib
# Should output: 10.0.0 or similarThe Nix flake ensures Arrow is available; these errors usually indicate you’re not in the Nix shell.
Some tests require R (for golden test comparisons). Check test logs:
dune runtest --verboseKnown issues: - Floating-point precision differences across platforms - R package availability for comparison tests
/home/user/...), not Windows mount
(/mnt/c/...)T works natively on NixOS:
# Add to configuration.nix or home-manager
environment.systemPackages = with pkgs; [
# T will be added to nixpkgs eventually
];For now, use nix develop as above.
Now that T is installed:
rm -rf ~/projects/tlang# Remove just T's dependencies (preserves other Nix packages)
nix-store --gc
# Or remove all unused packages
nix-collect-garbage -d# For multi-user install
sudo rm -rf /nix
sudo rm /etc/profile.d/nix.sh
sudo rm /etc/nix
# For single-user install
rm -rf ~/.nix-profile ~/.nix-defexpr ~/.nix-channels ~/.config/nixReady to start? Head to the Getting Started Guide!