Getting Started with Scala 3
Installing Scala 3 with Coursier
Install the Coursier Scala artifact fetcher.
Visit the Coursier website for detailed installation instructions on how to install Coursier.
(Coursier is the simplest way to get started with Scala, since it will automatically download and install all necessary dependencies for you).
Then, install Scala 3
Open a terminal and run the following commands:
cs install scala3-compilerto install the Scala 3 compiler.
cs install scala3to install the Scala 3 code runner
Use Scala 3
scala3 will start the Scala console, it is an interactive read-eval-print-loop that you can use to directly enter and run Scala expressions.
To use the Scala 3 compiler to compile a file
scala3-compiler test.scala in your terminal.
scala3 hello Scala will run the main method of a class called
hello, passing the argument
Installing Scala 3 with sbt
First, make sure you have the Java 8 JDK (or Java 11 JDK) installed.
To check, open the terminal and type:
java -version(Make sure you have version 1.8 or 11.)
The environment variable
JAVA_HOME should point to your Java installation.
Install the sbt build tool.
Visit the sbt website for detailed installation instructions on how to install sbt.
(sbt is a build tool that allows you to compile, run, test, and deploy your Scala projects).
Create a project and use Scala 3
To create a new Scala 3 project, go to your terminal and run
sbt new scala/scala3.g8.
After entering the name of your project (let's say
MyProject), in your terminal go to the generated folder (for example
myproject) and run the command
You should be greeted with a friendly message.
(Following conventions for the directory structure, the Scala source files are located under
Other ways to install Scala
Download the Scala binaries for 3.1.0 at github.
Need help running the binaries?
- Using SDKMAN!, you can easily install the latest version of Scala on any platform by running the following command:
sdk install scala
- On macOS you can also use Homebrew and run the following commands:
brew install lampepfl/brew/dotty
- Use Scastie to run single-file Scala programs in your browser using multiple Scala compilers; the production Scala 2.x compilers, Scala.js, Scala 3, and Typelevel Scala. Save and share executable Scala code snippets.
Or are you looking for previous releases of Scala?
Release NotesFor a summary of important changes, see the GitHub release notes.
(Or consult our archive of older release notes.)
The Scala distribution is released under the Apache License, Version 2.0.