Skip to content

Latest commit

 

History

History
723 lines (556 loc) · 19.6 KB

_advanced_install.mdx

File metadata and controls

723 lines (556 loc) · 19.6 KB

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import SectionAbout from "../src/components/SectionAbout" import DownloadButton from "../src/components/DownloadButton" import {currentOs} from "../src/components/osUtils";

Pick the installation method:

<Tabs groupId="operating-systems-specific" defaultValue={currentOs()} values={[ {label: 'Windows', value: 'windows'}, {label: 'MacOs', value: 'mac'}, {label: 'Linux', value: 'linux'}, {label: 'BSD', value: 'bsd'}, ]}

<Tabs groupId="linux" defaultValue="manual" values={[ {label: 'Manual', value: 'manual'}, {label: 'Apt', value: 'apt'}, {label: 'Deb', value: 'deb'}, {label: 'Yum', value: 'yum'}, {label: 'Rpm', value: 'rpm'}, {label: 'Alpine', value: 'alpine'}, {label: 'Nix', value: 'nix'}, {label: 'SDKMAN', value: 'sdkman'}, ]}

Download the launcher from GitHub release assets with

curl -fL https://github.com/Virtuslab/scala-cli/releases/latest/download/scala-cli-x86_64-pc-linux.gz | gzip -d > scala-cli
chmod +x scala-cli
sudo mv scala-cli /usr/local/bin/scala-cli

Check that it runs fine by running its version command:

scala-cli version

Scala CLI can be installed via apt packager tool.

curl -sS "https://virtuslab.github.io/scala-cli-packages/KEY.gpg" | sudo gpg --dearmor  -o /etc/apt/trusted.gpg.d/scala-cli.gpg 2>/dev/null
sudo curl -s --compressed -o /etc/apt/sources.list.d/scala_cli_packages.list "https://virtuslab.github.io/scala-cli-packages/debian/scala_cli_packages.list"
sudo apt update
sudo apt install scala-cli

The Debian package can be downloaded at this address.

Alternatively, you can download it and install it manually with:

curl -fLo scala-cli.deb https://github.com/Virtuslab/scala-cli/releases/latest/download/scala-cli-x86_64-pc-linux.deb
sudo dpkg -i scala-cli.deb

Scala CLI can be installed via yum packager tool.

cat << EOF | sudo tee /etc/yum.repos.d/virtuslab.repo
[virtuslab-repo]
name=VirtusLab Repo
baseurl=https://virtuslab.github.io/scala-cli-packages/CentOS/Packages
enabled=1
gpgcheck=1
gpgkey=https://virtuslab.github.io/scala-cli-packages/KEY.gpg
EOF
sudo yum repo-pkgs virtuslab-repo list
sudo yum install scala-cli

The RPM package can be downloaded at this address.

Alternatively, you can download it and install it manually with:

curl -fLo scala-cli.rpm https://github.com/Virtuslab/scala-cli/releases/latest/download/scala-cli-x86_64-pc-linux.rpm
sudo rpm -i scala-cli.rpm

Download the launcher from GitHub release assets with

wget -q -O scala-cli.gz  https://github.com/Virtuslab/scala-cli/releases/latest/download/scala-cli-x86_64-pc-linux-static.gz && gunzip scala-cli.gz
chmod +x scala-cli
mv scala-cli /usr/bin/

Check that it runs fine by running its version command:

scala-cli version

:::info This method is provided and supported by the community, not the core team of Scala CLI :::

Scala CLI can be installed with Nix with

nix-env -iA nixpkgs.scala-cli

Scala CLI can be installed via SDKMAN with

sdk install scalacli

<Tabs groupId="windows" defaultValue="manual" values={[ {label: 'Manual', value: 'manual'}, {label: 'Installer', value: 'installer'}, {label: 'SDKMAN', value: 'sdkman'}, {label: 'Chocolatey', value: 'choco'}, {label: 'Scoop', value: 'scoop'}, {label: 'WinGet', value: 'winget'}, ]}

Note that the Windows manual installation requires Visual C++ redistributable to be installed. See below for how to install it.

Download the launcher from GitHub release assets with

curl -fLo scala-cli.zip https://github.com/Virtuslab/scala-cli/releases/latest/download/scala-cli-x86_64-pc-win32.zip
tar -xf scala-cli.zip

Check that it runs fine by running its version command:

scala-cli version

If you get an error about MSVCR100.dll being missing, you have to install Visual C++ redistributable. A valid version is distributed with the Scala CLI launchers. You can download it here, and install it by double-clicking on it. Once the Visual C++ redistributable runtime is installed, check that the Scala CLI runs fine by running its version command:

scala-cli version

Note that the commands above don't put the scala-cli command in the PATH. For that, you can create a directory, move the launcher there, and add the directory to the PATH with

md "%USERPROFILE%/scala-cli"
scala-cli add-path "%USERPROFILE%/scala-cli"
move scala-cli.exe "%USERPROFILE%/scala-cli"

Download MSI installer with Scala CLI for Windows

Scala CLI can be installed via SDKMAN with

sdk install scalacli

To install Scala CLI via Chocolatey, run the following command from the command line or from PowerShell:

choco install scala-cli

:::note Third-party Chocolatey packages may not provide the latest version. :::

To install Scala CLI via Scoop, run the following command from the command line or from PowerShell:

scoop install scala-cli

To install Scala CLI via WinGet, run the following command from the command line or from PowerShell:

winget install virtuslab.scalacli

<Tabs groupId="mac" defaultValue="brew" values={[ {label: 'Manual', value: 'manual'}, {label: 'Installer', value: 'installer'}, {label: 'Brew', value: 'brew'}, {label: 'Nix', value: 'nix'}, {label: 'SDKMAN', value: 'sdkman'}, ]}

For a Mac with the arm64 architecture run the following commands:

curl -fL https://github.com/Virtuslab/scala-cli/releases/latest/download/scala-cli-aarch64-apple-darwin.gz | gzip -d > scala-cli
chmod +x scala-cli
mv scala-cli /usr/local/bin/scala-cli

Otherwise, for a Mac with non-arm64 architecture (pre-M1) run the following commands:

curl -fL https://github.com/Virtuslab/scala-cli/releases/latest/download/scala-cli-x86_64-apple-darwin.gz | gzip -d > scala-cli
chmod +x scala-cli
mv scala-cli /usr/local/bin/scala-cli

Check that it runs fine by running its version command:

scala-cli version

Download the PKG installer with Scala CLI for MacOS



Once downloaded, right-click on the downloaded file from Finder and then choose "Open".

Scala CLI can be installed via homebrew with

brew install Virtuslab/scala-cli/scala-cli

:::info This method is provided and supported by the community, not the core team of Scala CLI :::

Scala CLI can be installed via Nix with:

nix-env -iA nixpkgs.scala-cli

Scala CLI can be installed via SDKMAN with

sdk install scalacli
FreeBSD support (and support for other BSDs) is currently experimental and not stable. Scala CLI is not being distributed for FreeBSD, but you can install it via Coursier's standalone JAR.

Before running Coursier and installing Scala CLI, make sure you have Java 17 or higher installed and in your $PATH:

pkg install openjdk17

Note: Java 17 has to be installed manually on BSD systems at this time.

Download Coursier via the Any JAR option.

After downloading Coursier, you can use it to install Scala CLI:

chmod +x coursier
./coursier install scala-cli

Scala CLI is now installed on your system. It is installed as a JAR rather than a native binary, and so the startup time is slightly longer.

To run scala-cli anywhere on your system, you need to add its binary path to the $PATH variable. For a given user-directory:

export PATH="$PATH:/home/user-directory/.local/share/coursier/bin"

Add this command to your shell's RC file to make the setting permanent.

Depending on the Java distribution you are using, it has been observed that Bloop (the build server used by Scala CLI) may have trouble starting on FreeBSD. You may try to customise Bloop JVM options with the BLOOP_JAVA_OPTS environment variable. Alternatively, you may skip using the build server altogether and use the compiler directly by passing the --server=false option. Please note that doing this will noticably extend project build times.

scala-cli run -e 'println("Hello FreeBSD")' --server=false

Any features relying on third-party JVMs (such as --jvm and package --native-image) may not work on FreeBSD, as those JVMs may not have BSD distributions provided. They may be made to work when a compatible JVM path is provided directly (refer to individual sub-commands' --help).

Script to automatically download and cache standalone scala-cli launcher.

<Tabs groupId="specific-standalone-launcher" defaultValue="macOS/Linux" values={[ {label: 'macOS/Linux', value: 'macOS/Linux'}, {label: 'Windows', value: 'windows'} ]}>

In certain restricted environments, jar files may only be accessible through Nexus or a specific Artifactory, making it cumbersome to manually load each dependency and construct the classpath. To simplify this process, run the bootstrapped Scala CLI standalone fat jar using Coursier, follow the command below:

cs launch org.virtuslab.scala-cli:cliBootstrapped:latest.release -M scala.cli.ScalaCli

Alternatively, you can directly download it from the Maven repository here.

Try the completions with

<Tabs groupId="shell-specific" defaultValue="bash" values={[ {label: 'Bash', value: 'bash'}, {label: 'zsh', value: 'zsh'}, ]}>

eval "$(scala-cli install completions --env --shell bash)"
scala-cli --<TAB>
eval "$(scala-cli install completions --env --shell zsh)"
scala-cli --<TAB>

Install them on your system with

scala-cli install completions

If any of the scala-cli install completions command complained that your shell cannot be determined, specify it with --shell <Tabs groupId="shell-specific" values={[ {label: 'Bash', value: 'bash'}, {label: 'zsh', value: 'zsh'}, ]}>

scala-cli install completions --shell bash
scala-cli install completions --shell zsh

To run Scala.js applications Node.js needs to be installed. Scala CLI at this moment does not manage Node.js however it may change in the future.

Clang is required to compile and run Scala Native applications. Using some functionalities known from JDK (like using java.util.zip package) require additional packages to be installed.

Scala Native page contains detailed installation guide.

Pick the uninstallation method:

<Tabs groupId="uninstall-specific" defaultValue={currentOs()} values={[ {label: 'Windows', value: 'windows'}, {label: 'MacOs', value: 'mac'}, {label: 'Linux', value: 'linux'}, ]}

<Tabs groupId="linux" defaultValue="installation-script-u" values={[ {label: 'Installation script', value: 'installation-script-u' }, {label: 'Manual', value: 'manual-u'}, {label: 'Apt', value: 'apt-u'}, {label: 'Deb', value: 'deb-u'}, {label: 'Yum', value: 'yum-u'}, {label: 'Rpm', value: 'rpm-u'}, {label: 'Alpine', value: 'alpine-u'}, ]}

If Scala CLI was installed via the installation script, you can uninstall it with:

scala-cli uninstall

If you have installed Scala CLI completions into your shell, uninstall command uninstalls them by running uninstall-completions command under the hood.

If Scala CLI was installed manually you can uninstall it with:

rm /usr/local/bin/scala-cli

If Scala CLI was installed via apt you can uninstall it with:

sudo apt purge scala-cli

If Scala CLI was installed via dpkg you can uninstall it with:

sudo dpkg --remove scala-cli

If Scala CLI was installed via yum you can uninstall it with:

yum remove scala-cli

If Scala CLI was installed via rpm you can uninstall it with:

rpm -e scala-cli

For Alpine Linux you can uninstall scala-cli with:

rm /usr/bin/scala-cli

<Tabs groupId="windows" defaultValue="manual-u" values={[ {label: 'Manual', value: 'manual-u'}, {label: 'Installer', value: 'installer-u'}, {label: 'Chocolatey', value: 'choco'}, ]}

If Scala CLI was installed manually you can uninstall it with:

rmdir "%USERPROFILE%/scala-cli"

If Scala CLI was installed via the installer, you can uninstall it in the Control Panel.

To uninstall Scala CLI via Chocolatey, run the following command from the command line or from PowerShell:

choco uninstall scala-cli

<Tabs groupId="mac" defaultValue="installation-script-u" values={[ {label: 'Installation script', value: 'installation-script-u' }, {label: 'Manual', value: 'manual-u'}, {label: 'Brew', value: 'brew-u'}, ]}

If Scala CLI was installed via the installation script, you can uninstall it with:

scala-cli uninstall

If you have installed Scala CLI completions into your shell, uninstall command uninstalls them by running uninstall-completions command under the hood.

If Scala CLI was installed manually you can uninstall it with:

rm /usr/local/bin/scala-cli

If Scala CLI was installed via homebrew you can uninstall it with:

brew uninstall scala-cli