← Back to Scala Course | Chapter 1: Setup & Basics | Lesson 2 of 8

Installing Scala

Installing Scala is like getting your art supplies before painting. Scala runs on top of Java's engine, so you install that first and then add Scala on top.

In this page:

  1. Installing Scala

Installing Scala

Scala runs on the JVM, so a JDK must be installed first, followed by the Scala toolchain itself (compiler, REPL, and build tools). Most developers install Scala via coursier (the cs command) or a package manager.

Once installed, scala and scalac become available on your PATH.

Note: Run scala -version after installing to confirm both the JVM and Scala toolchain are set up correctly.

Example: Installing Scala

bash
# Linux (using coursier)
curl -fL https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-linux.gz | gzip -d > cs
chmod +x cs && ./cs setup

# macOS (Homebrew)
brew install scala

# Windows (Chocolatey)
choco install scala

# Verify installation (all platforms)
scala -version

⚠️ Run this in your own terminal or Node.js environment.

Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
Common Mistakes
  1. Installing Scala without a JDK first, so the scala or scalac command fails because there is no Java runtime.
  2. Not opening a new terminal after installation, so scala is reported as command not found because the PATH was not refreshed.
  3. Installing a very new Scala version while using an old JDK, when the two must be compatible.
🔒

Chapter Quiz — Complete all 8 topics to unlock

0/8 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.