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 scala3-replto install the Scala 3 interactive read-eval-print loop.
Use Scala 3
scala3-repl will start a Scala console that you can use to interactively evaluate Scala programs. Within this console, run the command
:load test.scala to load and execute the file
To use the Scala 3 compiler to compile a file
test.scala simply run
scala3-compiler test.scala in your terminal.
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.0.1 at github.
Need help running the binaries?
- On macOS you can also use Homebrew and runthe 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.