MANPATH, 'whereis' and how manuals are located?
0
votes
1
answer
191
views
I use a 2023 M2 MBP running Ventura 13.7.2. To augment Apple's rather paltry offerings of CL utilities, I depend on MacPorts. Unfortunately, MacPorts does not have a replacement/alternative for
whereis
.
If you've ever used Apple's native whereis
you may have noticed that it has some ***shortcomings***; e.g.:
/usr/bin/whereis find
find: /usr/bin/find /opt/local/libexec/gnubin/man/man1/find.1.gz
First - it only reports on native apps**See EDIT 1 below**. Its **app** searches are restricted by Apple, and apparently this cannot be over-ridden by any user.
Second - as you can see above, it has no such restrictions on searching for manuals. In this case, it reports on the manual location for the find
tool which was installed from MacPorts.
Third - the native whereis
found the manpage for find
without benefit of the MANPATH
environment variable - it is not set on my system.
Fourth - AFAIK, that leaves only manpath
(another Apple-sourced CL utility) as a resource for finding the location of manuals. However, **as I read** man manpath
- it's not getting it from there either!
So that's my question: How does Apple's whereis
command find the location of system manuals? Have I mis-read man manpath
? Can someone explain the process?
Also, I'd be interested to know if Apple publishes the source files for manpath
and whereis
.
---
#### EDIT 1: "What is meant by native apps?"
From man whereis
on my system (dated "August 22, 2002, for macOS 13.7"):
>The default path searched is the string returned by the sysctl(8) utility for the “user.cs_path” string, with /usr/libexec and the current user's $PATH appended.
On my system:
% sysctl user.cs_path
user.cs_path: /usr/bin:/bin:/usr/sbin:/sbin
WRT ***"... Its app searches are restricted by Apple, and apparently this cannot be over-ridden by any user."***: You may refer to [this post](https://github.com/seamusdemora/seamusdemora.github.io/blob/master/MacStuff.md#39-whereis-vs-which-and-why-Apple-sucks) which was based on some research I did a while ago. Referring to man sysctl
on my current mac, is the following:
>COMPATIBILITY
The -w option has been deprecated and is silently ignored.
Asked by Seamus
(5329 rep)
Feb 3, 2025, 07:12 AM
Last activity: Feb 4, 2025, 08:22 AM
Last activity: Feb 4, 2025, 08:22 AM