The goal of efficiency is more slack.

Wednesday, March 17, 2010

Using Firefox to view man pages on OS X

Prerequisites:

  • Apache web server running
  • perl

Download man2html

man2html
Mac version I used

Install it

cd to the directory containing contents of tarball.
sudo perl install.me

Put man.cgi into local cgi-bin

Mac: cp man.cgi /Library/WebServer/CGI-Executables/

Configure man.cgi

First line:
#!/usr/bin/perl

Around line 126, add paths to your man pages, including programs you've installed (usually in /usr/local/), e.g. I've installed git:

@ManPath = qw(
/usr/share/man
/opt/local/man
/opt/local/share/man
/usr/local/git/share/man
);

Configure Apache

In /etc/apache2/httpd.conf:

<Directory "/Library/WebServer/CGI-Executables">
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>

Restart the server to reload the httpd.conf.

Configure Firefox

(source: tips4linux.com)

Go to Bookmarks > Organize Bookmarks;
Open a bookmark folder then right-click and chose New Bookmark;
Name the new bookmark man;
In the Location field paste this line:

http://localhost/cgi-bin/man.cgi?section=all&topic=%s

In the Keyword field type man;
Click Add.

Done. Sweet.

To view a man page, just type in the URL bar of Firefox:
man some-command

For example:
man ls

Popular Posts

Recent Posts

Unordered List

Text Widget

Pages

Powered by Blogger.
Scroll To Top