How to install Mercury lang?

Installing Mercury can be an intimidating process. Here are the steps I followed to get Mercury lang up and running.

  1. Download the latest ROTD. This tutorial uses a ROTD dated 2018-04-30, you should replace this date throughout.

  2. Uncompress the source archive

    $ tar -xzf mercury-srcdist-rotd-2018-04-30.tar.gz
    
  3. 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.

  4. Build the project

    $ make
    
  5. Install the project

    $ make install
    
  6. 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"
    
  7. Close the terminal and open a new one. Or $ source ~/.bashrc

  8. Get learning

social