macOS
Open the
terminal.app.Install Homebrew, take the defaults, in particular let it install in
/usr/local.Install
agda. Run:$ brew install agdaThis will install
agdaand all its dependencies. In particular:- It will install
GHC, a Haskell compiler. - It will install
emacs: let it do it, it is necessary to satisfy a dependency, but you will install a better version in a moment. - It will install and compile the
standard library. It is not needed for the lectures, but it is useful, and mandatory for many other things.
This should take less than a couple of minutes, but if
homebrewstarts compiling everything–which will take hours–see their FAQ.- It will install
Now you will install a windowed version of
emacs. Run:$ brew cask install emacs-macThis will install
emacsas an app you can launch by double-clicking.Now we need to make
emacsaware of theagdainstallation. Run:$ agda-mode setupOptional: make the standard library readily available to
agda. Run the following commands:$ mkdir ~/.agda $ echo "/usr/local/lib/agda/standard-library.agda-lib" > ~/.agda/libraries $ echo "standard-libary" > ~/.agda/defaults
An alternative is to use Stack. If you are so inclined, see instructions below.
Linux
Using the native package manager
These instructions are tested on Ubuntu 20.04.1 LTS (Focal Fossa). It will install Agda version 2.6.0.1, which is slightly behind, but totally fine for our purposes.
Install
agdausing your system’s package manager: This will installagdaand all its dependencies. In particular:- It will install
GHC, a Haskell compiler. - It will install
emacsif not previously installed - It will install and compile the
standard library. It is not needed for the lectures, but it is useful, and mandatory for many other things. - It will take care of
agda-mode, which will be packaged inside theemacsinstallation.
To install, run:
sudo apt install agdaon the command line.
- It will install
If installed this way, there is no need to make
emacsaware of theagdainstallation. You are fine.The standard library files are installed and the library is fully functional.
One file, namely
/usr/share/agda-stdlib/standard-library.agda-lib, only seems to be missing. But if you import the library it just works.We are not going to use the standard library in the course in any significant way.
Using Stack
Stack gives a predictable build. See instructions below
Windows
There may be several alternatives:
See the references for installation instructions.
If running
Windows 10, one can:- install one of the Linux distributions using the
Windows Subsystem for Linux. - Install Agda following the Linux installation instructions.
Check out the documentation.
- install one of the Linux distributions using the
Use
Stack
Using Stack
Check the instructions from Philip Wadler’s book. Make sure you have git.
Install stack:
- On macOS:
brew install haskell-stack - On Linux: if you are on Ubuntu,
sudo apt install haskell-stack - On Windows: https://docs.haskellstack.org/en/stable/install_and_upgrade/#windows
- On macOS:
Add
~/.local/binto yourPATH:$ echo "export PATH=~/.local/bin:$PATH" >> ~/.bashrc $ . ~/.bashrcYou only have to this once. You must figure out how to set environmental variables.
Get the
Agdasources: either download the Zip archive or usegit cloneas follows:$ git clone https://github.com/agda/agda.git $ cd agda $ git checkout v2.6.1stack install --stack-yaml stack-8.8.3.yamlIt will compile
Agdaand some of its prerequisites, so you are going to wait some time…… and it will be very long if you are doing this in a virtual machine.
Run
$ agda-mode setupOptional: for the standard library, either download the Zip archive, or
git clone https://github.com/agda/agda-stdlib.git cd agda-stdlib git checkout v1.3Do not do this inside the
agdadirectory you used to installAgda!Thus, if you have the standard library in
~/agda-stdlib, then do the following:$ test ! -d ~/.agda && mkdir ~/.agda $ echo "~/agda-stdlib/standard-libary.agda-lib" >> ~/.agda/libraries $ echo "standard-library" >> ~/.agda/defaults