Documentation Index
Fetch the complete documentation index at: https://mintlify.com/sbt/sbt/llms.txt
Use this file to discover all available pages before exploring further.
Installing sbt
sbt runs on the JVM and requires Java 8 or later. This guide will help you install both Java and sbt on your operating system.Prerequisites
sbt requires Java 8 or later. Java 17 is recommended for the best performance and latest features.
- Eclipse Temurin (formerly AdoptOpenJDK)
- Amazon Corretto
- Oracle JDK
Installation by Platform
- macOS
- Linux
- Windows
Using Homebrew (Recommended)
The easiest way to install sbt on macOS is with Homebrew:Manual Installation
- Download the latest sbt package from scala-sbt.org/download
- Extract the archive:
- Add sbt to your PATH:
- Add the export to your shell profile (
~/.zshrcor~/.bash_profile) to make it permanent
Verify Installation
After installation, verify that sbt is working:Understanding the sbt Launcher
Thesbt command you installed is actually a launcher script that:
- Detects the project’s sbt version from
project/build.properties - Downloads the correct version if needed
- Starts the sbt shell with appropriate JVM settings
The sbt Launcher Script
The launcher script (from~/workspace/source/sbt) provides several useful features:
- Auto-detection of project sbt version
- Memory configuration via
SBT_OPTS - Debug mode with
-dflag - Verbose mode with
-vflag - Color output (can be disabled with
--no-colors)
Native Client (sbtn)
sbt 2.x includes a native thin client calledsbtn for faster startup:
- Sub-second command execution (no JVM startup wait)
- Persistent build state across commands
- Lower memory usage for quick tasks
The native client (
sbtn) requires a one-time build of the native image or can be installed via package managers. It’s optional but recommended for the best experience.Configuration
Memory Settings
For large projects, you may need to increase sbt’s memory:Global Settings
You can configure global sbt settings in~/.sbt/:
~/.sbt/1.0/global.sbt- Global build settings~/.sbt/1.0/plugins/- Global plugins~/.sbt/repositories- Custom repository configuration
Proxy Configuration
If you’re behind a corporate proxy:Troubleshooting
Command Not Found
If you get “command not found” after installation:- Check that sbt is in your PATH:
echo $PATH - Verify the installation directory
- Restart your terminal to reload the PATH
Permission Denied
If you get permission errors:Java Version Issues
If sbt complains about Java version:Download Issues
If sbt fails to download dependencies:- Check your internet connection
- Verify proxy settings if behind a firewall
- Try clearing the Ivy cache:
rm -rf ~/.ivy2/cache
Next Steps
Now that you have sbt installed, let’s create your first project:Quick Start Guide
Build your first “Hello World” application with sbt
Upgrading sbt
To upgrade to a newer version of sbt:- macOS
- Linux (apt)
- Windows (Scoop)
For existing projects, update the
project/build.properties file to use the new version: