The Robservatory

Robservations on everything…


Open Unix man pages in their own Terminal window

A while back, I wrote about opening Unix man pages in Preview, and this is still my preferred method of browsing man pages. However, there may be times where Preview is overkill, and you want to stay in Terminal, maybe for a short help file such as that for ln. But opening a new window by hand is a bit of a pain, and tabs won’t work because you can’t see both the window and the man page at the same time.

While browsing the old Mac OS X Hints site, I found this nice solution: Open man pages in a new Terminal window, one that’s set up just for reading such pages. It looks something like this (though I’ve customized my setup; keep reading)…

Adding a few lines to your shell’s startup file makes opening these ‘in their own window’ man pages as easy as opening ‘regular’ man pages.

To make this work, add the following code to your .profile or .bash_profile file, in your user’s home folder:

function winman {
    if [ $# -eq 1 ] ;
        then open x-man-page://$1 ;
    elif [ $# -eq 2 ] ;
        then open x-man-page://$1/$2 ;

You can change winman to whatever you like; if you use man, then this function will override the default man command. Save the changes, then close and open the Terminal window (or source .profile), and you can type, for instance, winman ln to get a new window with the man page for ln. The first time you use this new command, the new window will look like this:

Whoa, that’s bright! And probably totally unlike your main Terminal window settings. What controls what you see when you use this command? It turns out there’s a dedicated man page viewer window in Terminal’s preferences:

Change the window size, colors, font size, background image, or whatever, to suit your preferences. Any changes you make here will be reflected the next time you use the winman (or whatever you named it) command. Neat!


Add a Comment
  1. Clever trick! But I still prefer to use Bwana ( combined with a shell function:

    function sman
    open -a Bwana man:$1

    Then I can read a nicely formatted page in Safari, with hyperlinks to other similarly formatted manpages.

  2. If you use Dashboard it is possible to find widgets for man pages.

    If you don’t mind using the trackpad, I find it easier to just write the command (ln in your example) and the right-clicking it and use the command for opening the man page. It opens in a new window.

Leave a Reply

The Robservatory © 2017 Built from the Frontier theme