2.1. Installing Clash

2.1.1. Installing via Snap

Clash is released as a binary package on snapcraft. Snap is supported on all major Linux distributions. Visit Clash’s snapcraft page, scroll down, and choose your distribution for installation instructions. To install the latest stable version, use:

snap install clash

To install the latest development version of Clash, run:

snap install clash --edge

This version is updated every 24 hours.

2.1.2. Installing via Source (Linux / MacOS)

Install the latest nix and run:

curl -s -L https://github.com/clash-lang/clash-compiler/archive/1.2.tar.gz | tar xz
nix-shell clash-compiler-1.2/shell.nix

See the releases page for all available versions of the compiler.

2.1.3. Installing via Source (Windows)

  1. Install Stack

  2. Download the source code of Clash 1.2

  3. Unpack the archive

  4. Use cd to navigate to the unpacked directory

  5. Run stack build clash-ghc. This will take a while.

See the releases page for all available versions of the compiler. To run clashi, execute:

stack run clashi

To compile a file (to VHDL) with Clash, run:

stack run clash -- path/to/your/file.hs --vhdl

2.1.4. Installing via Source (HEAD)

Clone Clash from github using git and enter the cloned directory:

git clone https://github.com/clash-lang/clash-compiler.git
cd clash-compiler

Use one of the build tools below to get Clash up and running.

2.1.4.1. Cabal

Install Cabal >= 2.4 and GHC >= 8.4. Even though GHC 8.6 is supported, we currently recommend running 8.4 as the former contains some known bugs concerning documentation generation. If you’re using Ubuntu, add HVR’s PPA and install them using APT:

sudo add-apt-repository -u ppa:hvr/ghc
sudo apt install ghc-8.4.4 cabal-install-2.4

Add /opt/ghc/bin to your PATH. Finally, run Clash using cabal:

cabal new-run --write-ghc-environment-files=always -- clash

2.1.4.2. Stack

You can use Stack to build and run Clash too:

stack run -- clash

2.1.4.3. Nix

Or use Nix to get a shell with the clash and clashi binaries on your PATH:

nix-shell