Installation
These instructions will install the coursier CLI cs
itself, as well as a typical Scala development environment.
By default, they will install the following applications:
cs
itself, to further manage your Scala environmentscala
, the Scala 2 REPLscalac
, the Scala 2 compilersbt
andsbtn
, the sbt build tooldammonite
, an enhanced REPL for Scala 2scalafmt
, the Scala code formatter
They will also install a JVM if none is found on the system.
If you want more control over what gets installed and how, read about the setup
command.
After the setup, you can start using Scala, or install more applications with the install
command.
Native launcher
Linux
On Linux, download and run the coursier installer with
$ curl -fL https://github.com/coursier/launchers/raw/master/cs-x86_64-pc-linux.gz | gzip -d > cs
$ chmod +x cs
$ ./cs setup
macOS
On macOS, download and run the coursier installer with
$ curl -fL https://github.com/coursier/launchers/raw/master/cs-x86_64-apple-darwin.gz | gzip -d > cs
$ chmod +x cs
$ ./cs setup
macOS - brew based installation
Alternatively, the coursier launcher can be installed via homebrew with
$ brew install coursier/formulas/coursier
$ cs setup
Windows
On Windows, download and execute the Windows installer.
If you prefer a command line-based install, or if you would like to customize the setup options, use:
# CMD
> curl -fLo cs-x86_64-pc-win32.zip https://github.com/coursier/launchers/raw/master/cs-x86_64-pc-win32.zip
> tar -xf cs-x86_64-pc-win32.zip
> move cs-x86_64-pc-win32.exe cs.exe
> .\cs --help
Check your setup
Check your setup with
$ scala -version
Scala code runner version 2.13.7 -- Copyright 2002-2021, LAMP/EPFL and Lightbend, Inc.
If that does not work, you may need to log out and log back in (or reboot) in order for the changes to take effect.
JAR-based launcher
In case you run into any issue with the native launcher, a JAR-based launcher is available.
The commands below install the JAR-based launcher as
coursier
, which can be substituted tocs
in the various examples on this website.
Linux / macOS
Download and run the launcher with
$ curl -fLo coursier https://github.com/coursier/launchers/raw/master/coursier &&
chmod +x coursier &&
./coursier
Note that the JAR-based launcher requires Java 8 or later to run.
That is, a command like java -version
should print a version >= 8.
The JAR-based launcher weights only about 25 kB and can be easily embedded as is in other projects. It downloads the artifacts required to launch coursier on the first run.
Alternatively, on macOS, the JAR-based launcher can be installed via homebrew with
$ brew install coursier/formulas/coursier
$ coursier
Windows
Install and run the JAR-based coursier launcher from the current directory at the Windows prompt, with
# CMD
> bitsadmin /transfer downloadCoursierCli https://github.com/coursier/launchers/raw/master/coursier "%cd%\coursier"
> bitsadmin /transfer downloadCoursierBat https://github.com/coursier/launchers/raw/master/coursier.bat "%cd%\coursier.bat"
# PowerShell
> Start-BitsTransfer -Source https://github.com/coursier/launchers/raw/master/coursier -Destination coursier
> Start-BitsTransfer -Source https://github.com/coursier/launchers/raw/master/coursier.bat -Destination coursier.bat
You can then run coursier from the same directory, like
> coursier resolve io.circe:circe-core_2.12:0.10.0
Arch Linux
Install it from AUR,
$ pacaur -S coursier
FreeBSD
Install it via pkg
from the Ports Collection,
$ pkg install coursier
zsh completions
If you use ZSH, simple tab-completions are available by writing the coursier completion data into your completions directory. You can install the completions with:
mkdir -p ~/.zsh/completion
cs --completions zsh > ~/.zsh/completion/cs
echo 'fpath=(~/.zsh/completion $fpath)' >> ~/.zshrc
echo 'autoload -Uz compinit ; compinit' >> ~/.zshrc
Launcher URLs
Latest launchers
OS | Short URL | Long URL |
---|---|---|
Linux | https://github.com/coursier/launchers/raw/master/cs-x86_64-pc-linux.gz | |
macOS | https://github.com/coursier/launchers/raw/master/cs-x86_64-apple-darwin.gz | |
Windows | https://github.com/coursier/launchers/raw/master/cs-x86_64-pc-win32.zip | |
Linux (ARM64) | https://github.com/coursier/launchers/raw/master/cs-aarch64-pc-linux.gz | |
Any (needs JVM) | https://git.io/coursier-cli | https://github.com/coursier/coursier/raw/gh-pages/coursier (gh-pages branch of coursier repository rather than launchers repository) |
Any (needs JVM) | https://github.com/coursier/launchers/raw/master/coursier (same launcher as above) |
Specific versions
To download specific versions of the launcher, download them from GitHub release assets:
OS | URL | Since version |
---|---|---|
Linux | https://github.com/coursier/coursier/releases/download/v2.1.0-M3-1/cs-x86_64-pc-linux.gz | 2.0.16-158-gbdc8669f9 |
macOS | https://github.com/coursier/coursier/releases/download/v2.1.0-M3-1/cs-x86_64-apple-darwin.gz | 2.0.16-158-gbdc8669f9 |
Windows | https://github.com/coursier/coursier/releases/download/v2.1.0-M3-1/cs-x86_64-pc-win32.exe | 2.0.16-158-gbdc8669f9 |
Linux (ARM64) | https://github.com/coursier/coursier/releases/download/v2.1.0-M3-1/cs-aarch64-pc-linux.gz | 2.0.16-158-gbdc8669f9 |
Any (needs JVM) | https://github.com/coursier/coursier/releases/download/v2.1.0-M3-1/coursier | 1.1.0-M9 |
Former URLs, for information:
OS | URL | Since version | Up to version |
---|---|---|---|
Linux | https://github.com/coursier/coursier/releases/download/v2.1.0-M3-1/cs-x86_64-pc-linux | 2.0.0-RC3-1 | 2.0.16 |
macOS | https://github.com/coursier/coursier/releases/download/v2.1.0-M3-1/cs-x86_64-apple-darwin | 2.0.0-RC3-1 | 2.0.16 |
Windows | https://github.com/coursier/coursier/releases/download/v2.1.0-M3-1/cs-x86_64-pc-win32.exe | 2.0.0-RC6 | 2.0.16 |
Any (needs JVM) | https://github.com/coursier/coursier/raw/v1.1.0-M9/coursier | 1.1.0-M9 |