Open In App

How to Install Scala on MacOS?

Last Updated : 30 Nov, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

In this article, we are going to show you how you can download and install Scala on your Mac operating system. First of all, you need to download the Java JDK which you can download here

Downloading Scala on MacOS

Installing Scala on MacOS:

Follow the below steps to install Scala on MacOS:

Step 1: After installing JDK, run the following commands and make sure they don’t return an error :

javac -version
java -version

Installing Scala on MacOS

Step 2: Now, we need to download and install scala 

download the binary file from the official-website

Step 3: After downloading it you’ll have to extract it from the command line. And make sure to extract it in the root directory

tar -zxvf scala-2.12.8.tgz

Step 4: After extracting run the following command

sudo cp -R scala-X.XX /usr/local/scala

When you run this command the output like where you’ll find folders like bin, doc, lib, man.

Step 5: Open your .bash_profile file and run the following command :

sudo nano ~/.bash_profile

bash profile

Step 6: The following step is to change or add environment variables. Replace USERNAME with your actual username, but make sure your file location is right.

export SCALA_HOME="/Users/USERNAME/scala-2.12.6"
export PATH=$PATH:$SCALA_HOME/bin

 add environment variables

Step 7: Save and Restart the terminal.

 Save and Restart the terminal

Step 8: Now run the commands to check the Scala is installed properly.

scalac -version
scala -version

verifying Scala installation on macos


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads