Fundamentals 6 min read

How to Install Scala on macOS, Linux, and Windows

This guide walks you through installing Scala 2.11.7 on macOS/Linux and Windows, covering prerequisite Java setup, downloading the binary, configuring environment variables, and verifying the installation with command‑line checks.

Big Data Technology & Architecture
Big Data Technology & Architecture
Big Data Technology & Architecture
How to Install Scala on macOS, Linux, and Windows

Scala runs on Windows, Linux, Unix, and macOS, but it requires a Java JDK (version 1.5 or higher) to be installed and the JAVA_HOME environment variable set.

Step 1: Verify Java installation

$ java -version
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)
$ javac -version
javac 1.8.0_31

If Java is not installed, follow a Java development environment setup guide.

Step 2: Download Scala

Visit the official Scala download page (http://www.scala-lang.org/downloads) and download the binary package for version 2.11.7 .

On macOS/Linux, extract the archive and move it to /usr/local/share:

mv scala-2.11.7 scala
# rename if desired
mv /download/scalapath /usr/local/share   # adjust the source path to your actual download location

On Windows, run the downloaded .msi installer and accept the default installation directory.

Step 3: Configure environment variables

Edit the system profile (e.g., /etc/profile on Unix) with sudo if necessary:

vim /etc/profile
# or
sudo vim /etc/profile

Add the following line at the end of the file:

export PATH="$PATH:/usr/local/share/scala/bin"

On Windows, set SCALA_HOME to the installation directory (e.g., D:\Program Files (x86)\scala) and prepend %SCALA_HOME%\bin;%SCALA_HOME%\jre\bin to the Path variable. Also set CLASSPATH to

.;%SCALA_HOME%\bin;%SCALA_HOME%\lib\dt.jar;%SCALA_HOME%\lib\tools.jar.

Step 4: Verify the installation

Open a new terminal or command prompt and run:

$ scala
Welcome to Scala version 2.11.7 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_31).
Type in expressions to have them evaluated.
Type :help for more information.

If the Scala REPL starts, the installation was successful. Note that Chinese characters may appear garbled; refer to a Scala Chinese‑encoding fix guide if needed.

The table below summarizes typical environment variable settings for Unix and Windows:

System

Variable

Example Value

Unix

$SCALA_HOME
/usr/local/share/scala

Unix

$PATH
$PATH:$SCALA_HOME/bin

Windows

%SCALA_HOME%
c:\Progra~1\Scala

Windows

%PATH%
%PATH%;%SCALA_HOME%\bin
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxWindowsInstallationmacOSScalaEnvironment setup
Big Data Technology & Architecture
Written by

Big Data Technology & Architecture

Wang Zhiwu, a big data expert, dedicated to sharing big data technology.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.