logo

Scala 3

A next-generation compiler for Scala

(scroll down for more info)

Try Scala 3

There are multiple ways of getting started with Scala 3.

  1. You can try Scala 3 in your browser with Scastie.
  2. If you already have sbt installed, you can create a Scala 3 project and sbt will take care of the rest.
  3. You can install all necessary dependencies with coursier by running cs setup. You can also run cs install scala3-compiler or cs install scala3-repl to install command-line commands for the compiler and repl, correspondingly.
  4. You can manually install Scala 3 on your computer.

Install Scala 3

If you are a Mac user, you can install Scala 3 with brew:

brew install lampepfl/brew/dotty

If you are a Linux or Windows user, as a prerequisite you need a JDK 8 or later properly installed on your system. The environment variable JAVA_HOME should point to your Java installation.
For Windows users, we recommend using the Windows subsystem for linux or some other bash shell like git bash.
Then download the latest release. Optionally add the path of the folder bin/ to the system environment variable PATH.

Now you can compile Scala source code:

scalac hello.scala

To start the REPL, run: scala.

Create a Scala 3 Project

The fastest way to create a new project in Scala 3 is using sbt (1.1.4+).

Create a Scala 3 project:

sbt new lampepfl/dotty.g8

Or a Scala 3 project that cross compiles with Scala 2:

sbt new lampepfl/dotty-cross.g8

For documentation see the Scala 3 Example Project.

Learn more about Scala 3

You can find much more information about Scala 3 in ...