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

MANPATH should not be manually set UNIX

I don't think this has been explicitly covered anywhere on here, so here goes.

If you use the /usr -> share -> tcsh -> examples -> login file (as covered elsewhere), it will manually set the MANPATH variable in the line:

setenv MANPATH "${HOME}/man:/usr/local/share/man:/usr/share/man"

However, since 10.2 (I believe) the MANPATH variable has been deprecated because it is now generated dynamically from the PATH variable with a command also called MANPATH when it is needed. But it will fail if there is a MANPATH variable already set.

Therefore, it is a good idea to remove the line from the aforementioned login file (after making a backup, of course), and remove instances anywhere else of the the MANPATH variable being manually set in this manner.

Of course, this will probably all change with Panther in less than two weeks, but I thought it necessary to say!

[robg adds: I'm not sure I fully understand this one, but it seems worth publication and discussion, if nothing else.]

    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[10,492 views]  

MANPATH should not be manually set | 14 comments | Create New Account
Click here to return to the 'MANPATH should not be manually set' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
man manpath
Authored by: paulio on Oct 15, '03 11:01:07AM
Type

man manpath

at the terminal for the docs.

[ Reply to This | # ]

MANPATH should not be manually set
Authored by: iroot on Oct 15, '03 12:43:03PM

Do you have a quick way to test whether this is a problem? I have these set in my path and environment.mine files in ~/Library/init/tcsh/ and have not had a problem reading man pages.



[ Reply to This | # ]
MANPATH should not be manually set
Authored by: discordantus on Oct 15, '03 02:44:05PM

If you haven't noticed any problems, you probably don't need to to do anything. But if you've ever tried to get the manpage for a command that you know you have installed, and it said there was no manpage, you might want to check whether your $MANPATH variable is complete.

"manpath" will check for the $MANPATH variable, and use that if it is set. It won't try to locate any other paths, so you only have to make sure that all your man directories are in your $MANPATH variable.

running:
/usr/bin/locate '*/man'
will show you all possible man directories on your system. Compare them to the output of the manpath tool, and if there are any missing, you need to add them to your manpath variable.



[ Reply to This | # ]
MANPATH should not be manually set
Authored by: discordantus on Oct 15, '03 01:20:50PM

The manpath tool is a little dumb. The manpage claims that it tries to find other manpage directories in by looking at your $path variable, but it never worked for me. The only way I was able to get the alternate manpage paths into it was by editing the manpath config file.

After reviewing the manpath manpage, I located the config file (/etc/manpath.config) and popped it open in BBEdit. Part of it looked like this:


#
# set up PATH to MANPATH mapping
#
MANPATH_MAP /bin            /usr/share/man
MANPATH_MAP /usr/bin        /usr/share/man
MANPATH_MAP /usr/local/bin      /usr/local/man
MANPATH_MAP /usr/X11R6/bin      /usr/X11R6/man

I added a couple lines to that part:


MANPATH_MAP /sw/bin         /sw/share/man
MANPATH_MAP /opt/local/bin  /opt/local/man

Basically, these lines say "If (x) is in the user's path, add (y) to the manpath." You can add as many of these as you need to get your manpages working. The two that I added were for the fink project and darwinports.



[ Reply to This | # ]
MANPATH should not be manually set
Authored by: foobar104 on Oct 15, '03 02:17:26PM
Of course, this will probably all change with Panther in less than two weeks

Nope. No difference in Panther.

[ Reply to This | # ]

MANPATH should not be manually set
Authored by: peterneillewis on Oct 15, '03 08:50:28PM

Unfortunately fink sets the MANPATH in /sw/bin/init.csh (based on /usr/bin/manpath if it is not yet set) and that is typically sources from the start of .cshrc which is run before .login, so if you sety your path any time later, the manpath magic will not work.



[ Reply to This | # ]
MANPATH should not be manually set
Authored by: petruk on Oct 16, '03 05:40:23AM

I get the error "MANPATH: Undefined variable." everytime I open Terminal (ie. the first line in Terminal). Is this a related problem? Most manpages I need are available though...



[ Reply to This | # ]
"MANPATH: Undefined variable."
Authored by: porkchop_d_clown on Oct 16, '03 03:24:39PM

Without seeing your environment, that's kind of hard to diagnose.

I'd guess, however, that you have a .cshrc file that contains something like this:

setenv MANPATH $MANPATH:/my/other/directory/:/even/more/stuff/

If that's the problem, replace $MANPATH so that the line looks like this:

setenv MANPATH `manpath -q`:/my/other/directory/:even/more/stuff/

Hope this helps...

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



[ Reply to This | # ]
MANPATH should not be manually set
Authored by: porkchop_d_clown on Oct 16, '03 08:50:46AM

First, claiming that MANPATH shouldn't be manually set is bogus; if you don't do something like
setenv MANPATH /usr/local/man:/sw/share/man:/sw/man:${MANPATH}:/usr/X11R6/man
you're not going to get most of the extra man files you may have installed.

But this actually highlights another problem with the csh environment in recent Jaguar builds. Originally, Apple included in the default login scripts code to look in ~/Library/init/tcsh for extra shell initialization code. Sometime after 10.2, Apple removed this support from the default scripts; breaking me pretty thoroughly. Now you have to manually copy and rename the /usr/share/tcsh/examples to get the functionality back.

Now, with Panther, Apple has apparently decided to change the default shell altogether, apparently to appease the Linux crowd.

I can't wait to see what happens to fink when they do that!

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

[ Reply to This | # ]

MANPATH should not be manually set
Authored by: clith on Oct 16, '03 11:42:20AM
Read the previous posts. You don't have to manually set your MANPATH for darwinports or fink.

As for default shells, just use chsh if you don't like the default.

[ Reply to This | # ]

So your solution
Authored by: porkchop_d_clown on Oct 16, '03 03:17:40PM

to the problem of manually set manpaths is to manually set the manpath config?

In what sense is that an improvement?

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



[ Reply to This | # ]
So your solution
Authored by: discordantus on Oct 17, '03 02:23:27AM

I suppose it's really a matter of taste, but here's my take on it...

It is an improvement because the MANPATH variable appears to be deprecated. All utilities that need those paths are now supposed to run the 'manpath' util to get them. 'manpath' will use the MANPATH variable if it exists, but will print an error message to stderr. Also, if you set the MANPATH variable manually, and Apple decides to stick in a new man directory in the future, 'man' won't be able to find it. I guess it's just the new way that they are doing things...



[ Reply to This | # ]
So your solution
Authored by: pjt33 on Oct 18, '03 02:59:03PM
I don't know whether it works in tcsh, but in sh/bash, the simple solution is
export MANPATH=`manpath`:/sw/share/man


[ Reply to This | # ]
chsh
Authored by: porkchop_d_clown on Oct 16, '03 03:19:29PM

Indeed. You can change your shell. All the less reason to change the default shell, forcing changes to many 3rd party apps (like fink)

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



[ Reply to This | # ]