Skip to content
Published on

Setting Up a Scala Development Environment on Mac

Authors
  • Name
    Twitter

Setting Up a Scala Development Environment

Use the Brew package manager to download coursier. (It is a dependency management tool for Scala.)

brew install coursier/formulas/coursier

Then run the following command to proceed with setup, which registers Scala in your PATH and downloads the default libraries.

cs setup

Download the desired Scala version.

cs install scala:2.12.15 scalac:2.12.15

Add the Scala installation path export to the bottom of ~/.zshrc, and after closing and reopening the terminal, you will be able to run the scala command from the terminal.

export PATH="$PATH:/Users/<username>/Library/Application Support/Coursier/bin"

Scala REPL Environment Test

Scala provides a REPL(Read-Eval-Print-Loop) environment.

$ scala

Welcome to Scala 2.12.15 (OpenJDK 64-Bit Server VM, Java 18.0.1.1).
Type in expressions for evaluation. Or try :help.

scala> val a = 1;
a: Int = 1

scala> print(a)
1
scala>