Mike Slinn

Scala CLI

— Draft —

Published 2024-08-17.
Time to read: 1 minutes.

How to install and work with Scala CLI.

scala-cli replaced the Scala runner for Scala 3.5.0. This only impacts people who use the Scala REPL instead of the sbt REPL, or who use Scala Script, covered in Scala and Shell Scripts.

You can explicitly use Scala CLI to run a Scala REPL by typing:

Shell
$ scala-cli
Welcome to Scala 3.4.2 (21.0.4, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
scala>

My computer had several versions of Scala installed via various means, including Scala 3.4.2 and 3.5.0, installed via Coursier. However, as you can see from the above, even Scala CLI chose to run Scala 3.4.2, even though 3.5.0 was the default.

Scala CLI was supposed to replace the Scala command for Scala 3.5.0, but I found the following:

Shell
$ scala-cli
[warning] MainGenericRunner class is deprecated since Scala 3.5.0, and Scala CLI features will not work.
[warning] Please be sure to update to the Scala CLI launcher to use the new features.
[warning] It appears that your Coursier-based Scala installation is misconfigured.
[warning] To update to the new Scala CLI runner, please update (coursier, cs) commands first before re-installing scala.
[warning] Check the Scala 3.5.0 release notes to troubleshoot your installation.
Welcome to Scala 3.5.0 (21.0.4, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
scala>

This is merely another example of the usual chaos in the Scala ecosystem.


* indicates a required field.

Please select the following to receive Mike Slinn’s newsletter:

You can unsubscribe at any time by clicking the link in the footer of emails.

Mike Slinn uses Mailchimp as his marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp’s privacy practices.