Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

scala

How to install Scala and check Scala version on Mac

Faraz Karim

Scala is a language that brings together functional and object-oriented programming. It also provides support for the Java ecosystem and tool kits.

The easiest, most convenient method is to use the homebrew package manager to handle the Scala package. Alternative methods include downloading the fully-featured IDE that runs Scala (recommended for beginners).

You can visit the official Scala website for further details on this alternate method. In this article, we will be focusing on using the most simple and common method (command-line) in this article.

The homebrew package manager

The homebrew package manager handles all the dependencies and sets up the Scala environment, which makes our lives easier.

To install homebrew, open up your mac terminal and run the following command:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Scala installation

If you do not have any version of Scala on your system, it is straightforward to install one through the homebrew package manager. Just run the following commands:

brew install scala

Now you can run the

brew info scala

command to verify your installation.

Checking Scala version using homebrew

Now, with homebrew package manager installed, you can easily check the installation status of Scala by running the following command on your mac terminal:

brew info scala

You can also run the following command to get the installed version of Scala:

scala -version

Updating your Scala version

Check all Scala versions for that latest:

brew search scala

Install the latest version:

brew install scala@2.11

Unlink the currently-running Scala version on your system:

brew unlink scala

Link the newly downloaded one and use the force flag to remove the previously cached version:

brew link scala@2.11 --force

Check the current version, if it is updated, by running:

scala -version

RELATED TAGS

scala

CONTRIBUTOR

Faraz Karim
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring