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 setupdid not add~/.local/share/coursier/binto 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.02. Install sbt via SDKMAN
# SDKMAN installs sbt and manages versions
sdk install sbt
# Verify
sbt --version3. Install sbt via package manager
macOS (Homebrew):
brew install sbtUbuntu/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 sbt4. 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/sbt5. 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 permanently6. Verify Java installation
sbt requires JDK 11 or later:
java -version
# If missing, install a JDK:
cs install java:17.0.9 Previous
rustc: command not found
Next
Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro