Skip to content
sbt: command not found

sbt: command not found

DodaTech 2 min read

The “sbt: command not found” error means your shell cannot locate the sbt launcher binary, preventing you from building, testing, or running Scala projects.

What It Means

sbt (Scala Build Tool) is the standard build tool for Scala projects. The sbt command launches the build tool, which downloads dependencies, compiles code, runs tests, and packages applications. Without it in your PATH, you cannot use sbt from the command line.

Why It Happens

  • sbt is not installed on your system.
  • Coursier’s cs setup did not add ~/.local/share/coursier/bin to your PATH.
  • You installed sbt via a package manager but the binary path is not in your shell config.
  • The sbt launcher script was downloaded but not made executable.
  • Java is not installed — sbt requires a JDK to run.
  • The terminal session wasn’t reloaded after installation.

How to Fix It

1. Install sbt via Coursier (recommended)

# Bootstrap sbt using coursier
cs install sbt

# Verify
sbt --version
# Output: sbt version 1.10.0

2. Install sbt via SDKMAN

# SDKMAN installs sbt and manages versions
sdk install sbt

# Verify
sbt --version

3. Install sbt via package manager

macOS (Homebrew):

brew install sbt

Ubuntu/Debian:

echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add
sudo apt-get update
sudo apt-get install sbt

4. Manual installation

# Download the sbt launcher
curl -L -o sbt.zip https://github.com/sbt/sbt/releases/download/v1.10.0/sbt-1.10.0.zip
unzip sbt.zip
sudo mv sbt /usr/local/share/

# Create a symlink
sudo ln -s /usr/local/share/sbt/bin/sbt /usr/local/bin/sbt

5. Add sbt to your PATH

# If installed but not found, add the binary directory:
export PATH="$PATH:$HOME/.local/share/coursier/bin"

# Add to ~/.bashrc or ~/.zshrc permanently

6. Verify Java installation

sbt requires JDK 11 or later:

java -version
# If missing, install a JDK:
cs install java:17.0.9
What’s the difference between sbt and sbtn?
sbt is the standard launcher (requires Java). sbtn is a GraalVM native binary that starts faster but has some limitations. Both are included in recent sbt distributions.
Why does sbt take so long the first time I run it?
The first run downloads the sbt launcher version, the Scala compiler, and all declared dependencies. Subsequent runs are faster because artifacts are cached in ~/.cache/coursier and ~/.sbt.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro