One-click install for Scala

Monday 29 June 2020

Sébastien Doeraene

Installing Scala has always been a task more challenging than necessary, with the potential to drive away beginners. Should I install Scala itself? sbt? Some other build tools? What about a better REPL like Ammonite? Oh and before all that I need to install Java?

To solve this problem, the Scala Center contracted Alexandre Archambault in January 2020 to add a one-click install of Scala through coursier. For example, on Linux, all we now need is:

$ curl -Lo cs https://git.io/coursier-cli-linux && chmod +x cs && ./cs setup

You can find the instructions for macOS and Windows in the Coursier documentation.

The command shown above will install all the following software, if not yet installed:

  • a JDK
  • the build tools sbt and mill
  • the Ammonite enhanced REPL
  • scalafmt, the Scala formatter
  • the coursier CLI, to install further Scala-based applications
  • the scala and scalac command-line tools

With all those installed, we are ready to go! Later, cs update can be used to update the installation.

For power users, the cs setup command offers more configuration options, such as a non-interactive mode.

With this new simple, all-encompassing installer, we at the Scala Center hope to significantly reduce the burden of getting started with Scala.