Downloading Scala 3

I have been using the latest release of Scala 3 through sbt, but I am trying to figure out how to download the tar.gz file so I can invoke scala 3 from the bash command line (in Ubuntu Linux). I can’t seem to find out how to do that from the Scala download page. Am I missing something that should be obvious? Thanks.

2 Likes

Releases are available from Github: https://github.com/lampepfl/dotty/releases

Did you try those?

Do you need the Scala compiler and other tools? If you just want to launch your application consider generating a fat jar and calling that with java only. If you are using Sbt, it has a command to generate that jar. You need only add it to the java classpath.

I use the shell commands below to download the latest Scala 3 in my Ubuntu Terminal. I want Scala 3 under new names scala3 to not clash with my ordinary scala 2 install. (If you read this post much later than it was written check latest filenames at dotty/releases)

These shell commands assumes that you have ~/bin on your path…:

$ cd ~/Downloads
$ wget https://github.com/lampepfl/dotty/releases/download/3.0.0-RC1/scala3-3.0.0-RC1.zip
$ unzip scala3-3.0.0-RC1.zip
$ cd ~/bin
$ ln -s ~/Downloads/scala3-3.0.0-RC1/bin/scala scala3
$ scala3 -version
Starting scala3 REPL...
Scala compiler version 3.0.0-RC1 -- Copyright 2002-2021, LAMP/EPFL
scala> println("hello REPL")
hello REPL

Either do the same for scalac3 (or you can of course always add ~/Downloads/scala3-3.0.0-RC1/bin to your path if you are happy not reaching your old scala 2 runners in terminal).

1 Like

To run a Scala app on Ubuntu, I would use the SBT Native Packager to create a Debian package and install that.

3 Likes

I recently changed my setup to use Coursier for installing most Scala related tools, as it also makes it easy to keep things up to date.

After setting up coursier, cs install scala3-repl scala3-compiler will install Scala 3 (although the binaries will be named scala3-repl and scala3-compiler instead of scala3 and scalac3, but that can be fixed by a symlink or shell alias). Updating everything installed is just cs update.

4 Likes

sdkman (https://sdkman.io/) makes installing a lot of things JVM very easy. Also provides installs for the scala 3 m1/2/3 versions

1 Like