Installing Scala¶
Installing Scala is a straightforward process, but it can vary depending on your operating system and preferences. We will provide instructions for installing Scala on macOS, Linux, and Windows using the SDKMAN! tool. We will also discuss recommended IDEs and text editors for Scala development.
System Requirements¶
The most basic requirement for learning Scala is a computer with access to a command-line environment. We recommend using a macOS or Linux system; this will enable you to install the necessary tools directly, even during the session. If you are using Windows, must use Windows 11 and are strongly encouraged to set up the Windows Subsystem for Linux (WSL) to get a Linux-like environment. (You can also use a virtual machine with Linux installed, though this is not recommended for beginners.)
Installing SDKMAN!¶
SDKMAN! is a tool for managing parallel versions of multiple Software Development Kits (SDKs) on most Unix-based systems. It is the recommended way to install Scala and other tools.
macOS and Linux¶
Open a terminal.
Run the following command to install SDKMAN!:
curl -s "https://get.sdkman.io" | bash
Follow the on-screen instructions to complete the installation.
Restart your terminal or run:
source "$HOME/.sdkman/bin/sdkman-init.sh"
Verify the installation by running:
sdk version
Windows¶
Install the Windows Subsystem for Linux (WSL) if not already installed. Follow the instructions here: Install WSL.
Open a WSL terminal (e.g., Ubuntu).
Follow the same steps as for Linux above to install SDKMAN! within the WSL environment.
Installing Java and Scala¶
Once SDKMAN! is installed, you can use it to install Java and Scala. We recommend using the latest stable long-term support (LTS) versions of Java (version 21) and the latest version of Scala (version 3.7.0).
Open a terminal.
Run the following commands to install Java and Scala:
sdk install java sdk install scala
Verify the installation by running:
java -version scala -version
Recommended IDE: Visual Studio Code¶
(If you are using a text editor, you can skip this section.)
Visual Studio Code is a lightweight, open-source code editor that supports many programming languages, including Scala.
It is available for Windows, macOS, and Linux.
You can install it using your system’s package manager (such as apt
or brew
) or download it from the following URL:
When you open a Scala project folder for the first time, VS Code usually offers to install the Scala extension pack. It provides features like code completion, error checking, and debugging support.
IDE Alternative: JetBrains IntelliJ IDEA¶
Many faculty teaching introductory CS courses prefer an Integrated Development Environment (IDE). We recommend the free IntelliJ IDEA, which is growing in popularity over Eclipse and preferred by many of us. You can get the IDEA Community Edition for free from the following URL; it already includes the required Scala plugin.
Text Editors¶
Alternatively, in the spirit of the other command-line tools, you can use any text editor that you like to work with.
On Linux, we recommend Vim or Emacs. OS X Terminal also supports both via the command line or via the MacVim and Aquamacs projects. You can use any of these editors to write Scala code, but you may need to run the Scala compiler from the command line.
There are various other graphical text editors available, including Notepad++ for Windows and Sublime for all major platforms.