Installing Mercury can be an intimidating process. Here are the steps I followed to get Mercury lang up and running.
-
Download the latest ROTD. This tutorial uses a ROTD dated 2018-04-30, you should replace this date throughout.
-
Uncompress the source archive
$ tar -xzf mercury-srcdist-rotd-2018-04-30.tar.gz
-
Configure the installation to use only a few grades. This will save you a ton of compile time. Later if you decide you need more advanced features you can compile additional grades.
$ cd mercury-srcdist-rotd-2018-04-30 $ sudo apt-get install build-essential flex bison $ ./configure --disable-most-grades
At this point you may be asked to install additional dependencies. Install the dependencies and keep running
./configure
until it succeeds. -
Build the project
$ make
-
Install the project
$ make install
-
Add mercury to your PATHs. Add the following lines to your
~/.bashrc
(~/.bash_profile
on a mac).export PATH="/usr/local/mercury-rotd-2018-04-30/bin:$PATH" export MANPATH="/usr/local/mercury-rotd-2018-04-30/man:$MANPATH" export INFOPATH="/usr/local/mercury-rotd-2018-04-30/info:$INFOPATH"
-
Close the terminal and open a new one. Or
$ source ~/.bashrc