Installing mandoc from source

Mandoc is the manual page compiler toolset used by the BSD operating systems.

Arch Linux (and derivatives) uses the man-db package to provide a manpage parser/reader. While there is a mandoc package in the repo, it conflicts with man-db, so both cannot be installed at the same time. However, mandoc provides some useful features for manpage authors, namely a linter, HTML formatter, and documentation for the mdoc format.

This is how to install the mandoc program from source.

Download the sources:

curl https://mandoc.bsd.lv/snapshots/mandoc.tar.gz | tar xz
cd mandoc-1.14.6/

Configure the build by creating a file named configure.local. Refer to the provided configure.local.example and https://mandoc.bsd.lv/INSTALL.

echo 'PREFIX="$HOME/.local"' > configure.local
./configure

Build the program:

make

Check which files you want to have installed:

make -n install

Edit, then run the desired commands from the above output manually:

install -m 755 -Dt ~/.local/bin mandoc
install -m 644 -Dt ~/.local/share/man/man1 mandoc.1
install -m 644 -Dt ~/.local/share/man/man7 mdoc.7 mandoc_char.7