Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Read man pages in your browser Apps
A friend of mine showed me a nifty small utility called manServer which lets you read man pages in a browser. Besides the fact that that it is more pleasant to the eye, it also generates hyperlinks (Description, Options, See also, ...) on the fly, and makes reading and navigating man pages a real joy.

The file can be downloaded in the "See also" section of the above-linked web page. Should Safari append an ".html" to the file name during download, better remove it to prevent the local webserver from serving the page as html. I even just renamed the file simply to "man" here for less typing later.

Here's what you have to do to get it to work:
  • Open the file in a text editor and find the line that reads $ENV{'PATH'} = "/bin:/usr/bin"; and add another line below that reads:
    $ENV{'MANPATH'} = "/usr/share/man:/usr/local/man:
      /usr/local/share/man:/usr/X11R6/man";

    You might want to add additional man paths according to your needs (the line has been broken into two for narrower display; enter it as one long line with no additional spaces).
  • Put the file into /Library/WebServer/CGI-Executables
  • Make sure it's executable (chmod 755 manServer).
  • Start your local Apache via the Terminal or using Personal Web Sharing in the Sharing preferences panel
You can now access all local man pages by going to http://127.0.0.1/cgi-bin/man -- That is, if you named the downloaded file just "man" as I did. Otherwise, use whatever file name the file has in your cgi-bin.

[robg adds: I tested this app out and it works as expected, and is actually very useful -- the hyperlinks are a nice benefit. I had to control-click on the download and select "Save to disk" to prevent Safari from opening it in the browser, but after that, installation was as described, including the renaming step.]
    •    
  • Currently 2.25 / 5
  You rated: 1 / 5 (4 votes cast)
 
[14,322 views]  

Read man pages in your browser | 16 comments | Create New Account
Click here to return to the 'Read man pages in your browser' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Read man pages in your browser
Authored by: stevec on Jul 07, '03 10:59:18AM
Very cool, now if only some astute pearl hacker can make it so the listing of manpages is formatted so it is easier to read.

I don't know about everyone else but listings like this:

arp.4  bpf.4  divert.4  euc.4  faith.4  fd.4  gif.4  icmp.4  icmp6.4  inet.4  inet6.4  ip.4  ip6.4  ipfirewall.4  ipl.4  ipsec.4  lo.4  netintro.4  networking.4  null.4  pty.4  random.4  route.4  scsi.4  stderr.4  stdin.4  stdout.4  stf.4  tcp.4  termios.4  tty.4  tun.4  udp.4  unix.4  urandom.4  utf2.4 

are a bit hard to read.

Otherwise VERY cool indeed

Steve

[ Reply to This | # ]

Read man pages in your browser
Authored by: jtalkington on Jul 07, '03 12:04:58PM

I'm actually suprised that people haven't heard of stuff like this before, programs like this have been around for ages.

I'm partial to man2web, but I'm as biased as can be ;)

[ Reply to This | # ]

Read man pages in your browser
Authored by: bih on Jul 08, '03 06:39:55PM

You can make manServer display each man listing on a seperate line fairly easily. Open up the Perl script in your favorite text editor and look for the line:

print OUT "<A HREF=\"$root$request/$f\">$f</A>&nbsp;\n";

It should be in the sub-routine listDir.

Replace '&nbsp' with '<br>'

Hope this helps!



[ Reply to This | # ]
Read man pages in your browser
Authored by: rammjet on Jul 07, '03 12:00:07PM

If you read the Manserver pages carefully, you will see that it can spawn its own web server.

If you put Manserver into one of the bin directories, then run the command:

manserver -s

You can access the man pages with this URL:

http://127.0.0.1:8888/

or, to find a particular man page for, say, the "find" command, then use this URL:

http://127.0.0.1:8888/find

No need to fire up Apache if you don't want to.



[ Reply to This | # ]
Read man pages in your browser
Authored by: maise on Jul 07, '03 04:11:53PM

i dont find manserver on my system, what is the path to manserver ?



[ Reply to This | # ]
Read man pages in your browser
Authored by: mprewitt on Jul 07, '03 06:38:27PM

I believe "manserver -s" is a reference to the file you just downloaded. So if you renamed it "man" (as the example suggested), it would be "man -s". But I haven't tried this, so someone correct me if I'm wrong.



[ Reply to This | # ]
Read man pages in your browser
Authored by: seb2 on Jul 07, '03 07:42:20PM

That's exactly it.



[ Reply to This | # ]
Read man pages in your browser
Authored by: aaronfaby on Jul 07, '03 12:21:48PM

Also check out ManOpen:

http://www.versiontracker.com/dyn/moreinfo/macosx/2734

It's not web based, but it's a great man page viewer complete with hyperlinks and such.



[ Reply to This | # ]
Read man pages in your browser
Authored by: Beernd on Jul 07, '03 03:02:29PM

Cool, thanks! I'd been looking for something like this.

---
"Perhaps nothing is quite true, and not even that!"
Multatuli, Ideen 1



[ Reply to This | # ]
Best. Hint. Ever.
Authored by: porkchop_d_clown on Jul 07, '03 08:10:48PM

Well, maybe not "ever" but certainly in the top 10....

---
Everyone loves a clown, but no one will lend him money!



[ Reply to This | # ]
Read man pages in your browser
Authored by: bluehz on Jul 07, '03 09:56:54PM
I have used man-cgi since I found it over a year ago. Single scrip, drop it in your cgi dir. Thats it. No messy configuring or anything.

http://www.softlab.ntua.gr/~christia/man-cgi.html

on top of that you can create a nifty bookmark in your bookmark bar like this:

javascript:void(q%3Dprompt('What%20Man%20pages%20would%20you%20like%20to%20view?',''));if(q)void(location.href='http:%2F%2F127.0.0.1%2Fcgi-bin%2Fman-cgi%3F'+escape(q))

that will create a simple query dialog in your web browser. Click the bookmark (give it a nice icon with previous tips on using dingbats for bookmark bar icons), then you are no farther than a simple click - enter your man search term and it is displayed in the browser.

[ Reply to This | # ]

Read man pages in your browser
Authored by: osxpounder on Jul 09, '03 03:26:49PM

That's great, but I bet I'll have trouble remembering where to find this script and start it. I made a script in my home dir that would start up the manServer, but I bet there's a short & sweet way to ensure that the manServer starts up every time I log on. What do you recommend?

I haven't tried it before, but I am guessing that either AppleScript or a shell script could be made to start the manServer with the -s option. I just wonder which would be easiest. Ideally, I'd like something I could put in my Login Items, so that I'll see that it is there in the future and I'll be reminded that I have it starting automagically. Can one put an AppleScript in Login Items? I think so ....

---
--
osxpounder



[ Reply to This | # ]
Read man pages in your browser
Authored by: snx on Jul 15, '03 08:24:07AM

read man pages in your browser? no thanks ;)



[ Reply to This | # ]
Calling from shell
Authored by: sylvank on Jul 20, '03 08:33:34PM
I installed manServer_107 in /Library/WebServer/CGI-Executables/man.

Adding this alias to ~/.tcshrc lets me call up a man page in Safari from the shell.

alias wman 'open http://localhost/cgi-bin/man\?q=\!*'

Typing wman tcsh opens a new Safari window with the man page in it.



[ Reply to This | # ]
Read man pages in your browser
Authored by: vanthal on Jul 31, '03 07:11:09PM

For some reason, this won't bring up the man page for 'man' via the search box, though you can read it by browsing the 'man1' page or typing 'man man' in a console. A nice tool, nonetheless - the kind of thing you see a lot in Debian, if you poke around.



[ Reply to This | # ]
Read man pages in your browser
Authored by: dickg on Jun 06, '06 11:11:13AM

Works for Unix man-pages as well, but some .tags are not implemented, such as .Fd, .Bro, .Brc, .Brq and others. These occur in 'ipfw.8' and 'socket.2' just to name a couple. Otherwise, a very handy tool.



[ Reply to This | # ]