How to Install Scala on macOS
Step 1: Check for installation of Java Development Kit (JDK)
From a Terminal window, type:
$java –version
If it is already installed, skip to step 4.
Otherwise, download and install the JDK from http://www.oracle.com/technetwork/java/javase/
downloads/index-jsp-138363.html.
Step 2: Set environment variables for Java
export JAVA_HOME=/usr/local/java-current
export PATH=$PATH:$JAVA_HOME/bin/
Step 3: Verify install
Close and re-open the Terminal window, and type:
$java –version
Sample results
java version "11.0.3" 2019-04-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.3+12-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.3+12-LTS, mixed mode)
Step 4: Install Scala and SBT
To install, you must have an installation manager such as Homebrew (available at homebrew.sh).
From a Terminal window, type:
$ brew install scala
$ brew install sbt
Step 5: Add Scala to environment variables
To set up your environment variables on a Mac, you need to add these commands to your .bash_
profile file, which is located in your home directory. (Note: make sure that you don’t have hidden
files selected.)
export SCALA_HOME=/usr/local/share/scala
export PATH=$PATH:$SCALA_HOME/bin
Close and re-open the Terminal window, and type the following to verify the install: scala -version
No comments:
Post a Comment