Installing Scala
Scala needs a JDK (Java Development Kit) — version 17 or later — and the Scala tools. The recommended installer, Coursier, sets up both.
Windows
Download and run the Coursier installer (cs-x86_64-pc-win32.zip) from
the Scala website's install page, or use a package manager:
winget install --id VirtusLab.ScalaCLI
macOS
brew install coursier && coursier setup
Linux
curl -fL https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-linux.gz | gzip -d > cs
chmod +x cs && ./cs setup
cs setup installs a JDK if you don't have one, plus the scala
command, the sbt build tool, and more.
Check it works
$ scala version
Scala code runner version: 1.16.0
Scala version (default): 3.9.0
Since Scala 3.5, the scala command is Scala CLI: it compiles and
runs files, starts a REPL, manages dependencies, and runs tests. You'll
use it throughout the Beginner level; Level 2 introduces sbt, the
build tool used by most larger projects.
Try it without installing
Scastie (scastie.scala-lang.org) runs Scala in the browser — handy for trying the examples in this course.