This is the personal blog of Neil Ang. Simple and interesting technology articles written by a developer for developers. Feel free to comment on posts or link to this site. Constructive feedback is always welcomed.

How to install the W3C Link Checker on Mac OS X

Posted: 14 September 2007

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

How to install

The link checker requires these perl modules to run:

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
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
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!

Troubleshooting

Your comments (subscribe)

Gravatar

Alex 16 Sep 07 at 11:54am

Cool instructions. Good for beginners. For people who have played with Perl before then the LinkChecker makefile will let you know what modules you are missing (which you have noted). Rock on!

Gravatar

Neil Ang 17 Sep 07 at 10:23pm

Thanks Alex. I forgot to mention that there are also good instructions on how to install the validator on apple developer.

Gravatar

Kristin 19 Sep 07 at 8:32am

Look like good instructions (I'm very much a novice with perl setups), but I get stymied in that when installing config::general manually that I just downloaded from CPAN (automatically didn't work for me), I got this error: Checking if your kit is complete… Warning: the following files are missing in your kit: t/test.rc.out Please inform the author. Writing Makefile for Config::General mys-computer:~/Desktop/Config-General-2.33 my$ make -bash: make: command not found mys-computer:~/Desktop/Config-General-2.33 my$ make test -bash: make: command not found mys-computer:~/Desktop/Config-General-2.33 my$

Gravatar

Tony 25 Sep 07 at 7:38pm

Nice clear instructions Nang. The only problem I've ever faced is running the blasted thing from behind an authenticating HTTP proxy (such as the one we suffer from at work). Supposedly, loading mod_env (if it's not already loaded) and pushing the full proxy URL (including your username and password) into your Apache configuration will fix it, but I've not had the time to test it thoroughly.

Gravatar

Marty 14 Nov 07 at 3:05am

Cheers mate, great instructions there – certainly helped me out and i'll be sure to add these tips to my blog to help out any other Mac-heads out there =).

Post a comment

Comment Guidelines

  • You can subscribe to the comments on this entry via RSS.
  • Have no more than 2 links, otherwise your comment will be flagged as spam.
  • Links are automagically generated.
  • <em>text</em> to make text italic.
  • <strong>text</strong> to make text bold.

JavaScript needs to be enabled to comment.