There are several ways to install Agda:
- Using a released source package from Hackage
- Using a binary package prepared for your platform
- Using the development version from the Git repository
Agda can be installed using different flags (see Installation Flags).
Installation from Hackage¶
cabal update cabal install Agda agda-mode setup
The last command tries to set up Emacs for use with Agda via the Emacs mode. As an alternative you can copy the following text to your .emacs file:
(load-file (let ((coding-system-for-read 'utf-8)) (shell-command-to-string "agda-mode locate")))
It is also possible (but not necessary) to compile the Emacs mode’s files:
This can, in some cases, give a noticeable speedup.
Warning: If you reinstall the Agda mode without recompiling the Emacs Lisp files, then Emacs may continue using the old, compiled files.
If you use Nix-style Local Builds,
by using Cabal 220.127.116.11 or by running
cabal v2-install, you’ll get the
following error when compiling with the GHC backend:
Compilation error: MAlonzo/RTE.hs:13:1: error: Failed to load interface for ‘Numeric.IEEE’ Use -v to see a list of the files searched for.
This is because packages are sandboxed in
and you have to explicitly register required packaged in a GHC environment.
This can be done by running the following command:
cabal v2-install --lib Agda ieee754
This will register ieee754 in the GHC default environment.
You may want to keep the default environment clean, e.g. to avoid conflicts with other installed packages. In this case you can a create separate Agda environment by running:
cabal v2-install --package-env agda --lib Agda ieee754
You then have to set the
GHC_ENVIRONMENT when you invoke Agda:
GHC_ENVIRONMENT=agda agda -c hello-world.agda
Actually it is not necessary to register the Agda library, but doing so forces Cabal to install the same version of ieee754 as used by Agda.
Prebuilt Packages and System-Specific Instructions¶
The following prebuilt packages are available:
However, due to significant packaging bugs such as this, you might want to use alternative installation methods.
Debian / Ubuntu¶
Prebuilt packages are available for Debian and Ubuntu from Karmic onwards. To install:
apt-get install agda-mode
This should install Agda and the Emacs mode.
The standard library is available in Debian and Ubuntu from Lucid onwards. To install:
apt-get install agda-stdlib
Please report any bugs to Debian, using:
reportbug -B debian agda reportbug -B debian agda-stdlib
Agda is packaged in Fedora (since before Fedora 18).
yum install Agda
will pull in emacs-agda-mode and ghc-Agda-devel.
Nix or NixOS¶
Agda is part of the Nixpkgs collection that is used by https://nixos.org/nixos. To install Agda and agda-mode for Emacs, type:
nix-env -f "<nixpkgs>" -iA haskellPackages.Agda
If you’re just interested in the library, you can also install the library without the executable. The Agda standard library is currently not installed automatically.
However, if using existing Agda libraries (including the standard library) it
may be more convenient to use a nix expression for
nix-shell. A third-party
is available to create a
nix-shell environment that loads
agda-pkg as well as
agda-mode for emacs.
Homebrew is a free and open-source software package management system that provides prebuilt packages for OS X. Once it is installed in your system, you are ready to install agda. Open the Terminal app and run the following command:
brew install agda
This process should take less than a minute, and it installs Agda together with
its Emacs mode and its standard library. For more information about the
command, please refer to the Homebrew documentation
and Homebrew FAQ.
By default, the standard library is installed in the folder
/usr/local/lib/agda/. To use the standard library, it is
convenient to add the location of the agda-lib file
~/.agda/libraries file, and write the line
~/.agda/defaults file. To do this, run the following commands:
mkdir -p ~/.agda echo /usr/local/lib/agda/standard-library.agda-lib >>~/.agda/libraries echo standard-library >>~/.agda/defaults
It is also possible to install with the command-line option keywords
--without-ghc, or from
--HEAD. This requires
building Agda from source.
To configure the way of editing agda files, follow the section Emacs mode.
If Emacs cannot find the
agda-mode executable, it might help to
install the exec-path-from-shell package by doing
package-install RET exec-path-from-shell RET and adding the line
(exec-path-from-shell-initialize) to your
Installation of the Development Version¶
After getting the development version following the instructions in the Agda wiki:
Install the prerequisites
In the top-level directory of the Agda source tree
Follow the instructions for installing Agda from Hackage (except run
cabal installinstead of
cabal install Agda) or
You can try to install Agda (including a compiled Emacs mode) by running the following command:
Note that on a Mac, because ICU is installed in a non-standard location, you need to specify this location on the command line:
make install-bin CABAL_OPTS='--extra-lib-dirs=/usr/local/opt/icu4c/lib --extra-include-dirs=/usr/local/opt/icu4c/include'
When installing Agda the following flags can be used:
Enable debugging features that may slow Agda down. Default: off.
Installing multiple versions of Agda¶
Multiple versions of Agda can be installed concurrently by using the –program-suffix flag. For example:
cabal install Agda-2.6.1 --program-suffix=-2.6.1
will install version 2.6.1 under the name agda-2.6.1. You can then switch to this version of Agda in Emacs via
C-c C-x C-s 2.6.1 RETURN
Switching back to the standard version of Agda is then done by:
C-c C-x C-s RETURN