Neil Ang


A stunning likeness of Neil Ang
Hello world

How to install the W3C Link Checker on Mac OS X

Posted on

The W3C Link checker is a great online service for validating links. It is also freely available for download and use locally.

Advantages of a local link checking service

  • Intranet web site link validation
  • Faster validation for local sites
  • Increased recursive document limit
  • Command line link checker

How to install

The link checker requires these perl modules to run:

  • CGI
  • Config::General
  • HTML::Parser
  • LWP
  • Term::ReadKey
  • Time::HiRes
  • URI
  • Test::Simple
  • File::Spec

Mac OS X (10.4) comes with most of the required perl modules, but these were a few missing ones I had to install: Config::General, Net::IP and Term::ReadKey. You will know which modules you are missing when you try to install the link checker.

There are two options for installing the missing modules: the easy way through CPAN, or through manually downloading and building each module.

Installing missing modules through CPAN

Open a terminal window and enter:

sudo perl -MCPAN -e 'install Config::General'
sudo perl -MCPAN -e 'install Net::IP'
sudo perl -MCPAN -e 'install Term::ReadKey'

Simple, isn't it.

Installing missing modules manually

If you are on a private network or behind a proxy, you can manually install missing modules. Find, download and unpack the missing modules from CPAN.

Example installing Config::General. Open Termianl and type:

cd Desktop/Config-General-2.33/
perl Makefile.PL
make test
sudo make install

Install the Link Checker

Download the latest copy of the W3C LinkChecker package from CPAN, and unpack it on your desktop.

Change directory to the module directory and run the Makefile.

cd Desktop/W3C-LinkChecker-4.3
perl Makefile.PL

If there are any missing modules you will prompted with a warning like this:

Warning: prerequisite Config::General 2.06 not found.
Warning: prerequisite Net::IP 0 not found.
Warning: prerequisite Term::ReadKey 2 not found.
Writing Makefile for W3C::LinkChecker

If you are missing any modules, go back and install them as demonstrated earlier. Once you have all the prerequisite modules installed you can continue:

perl Makefile.PL
make test
sudo make install

The link checker should now be installed, and ready to be used from the command line. Typing the following command in terminal should present the version:

checklink --version

For full instructions on how to use the command-line link checker, type:

checklink --help

Installing the web interface

Mac OS X comes with an apache server built in. If you haven't yet turned on web sharing, do it now by selecting 'System Preferences' > 'Sharing' > and tick 'Personal Web Sharing'.

You will need to copy the checklink file to the default cgi-bin dir and enable execute permission. In a new terminal window type:

cd /Library/WebServer/CGI-Executables
cp ~/Desktop/W3C-LinkChecker-4.3/bin/checklink .
chmod 755 checklink

Done! In a browser navigate to: http://localhost/cgi-bin/checklink. Hopefully you will see a locally running copy of the link checker!


  • If you are experiencing server errors, check the server logs: /var/log/httpd/error_log
  • If you're server isn't even working, check the config: /etc/httpd/httpd.conf