Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-users: [Wireshark-users] Setting PATH and MANPATH on macOS, and moving the command-line

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Sat, 15 Oct 2016 13:55:06 -0700
The master and 2.2 branches have changes to

	1) put the man pages into the macOS app bundle under /Applications/Wireshark.app/Contents//Resources/share/man

and

	2) add a file named Wireshark, containing

/Applications/Wireshark.app/Contents/Resources/share/man

	   to /etc/manpaths.d.

/etc/profile, /etc/csh.login, and /etc/zprofile in macOS will run

	eval `/usr/libexec/path_helper -s`

for Bourne-compatible shells and

	eval `/usr/libexec/path_helper -c`

for the C shell.  This will construct a PATH setting from the contents of /etc/paths, and then scan /etc/paths.d for files and append to that PATH setting entries with the contents of each of those files.  That way, an installer that puts commands in its own directory, whether it's in an app bundle or under, for example, /opt/X11, can arrange to have login shells default to a PATH setting that includes their directory for commands.

path_helper *also* constructs a MANPATH setting from the contents of /etc/manpaths, and then scans /etc/manpaths.d for files and appends to that MANPATH setting entries with the contents of each of those files.

However, it only does that if MANPATH has already been set in the environment, and it typically is *NOT* set when /etc/profile etc. are run.

So, currently, adding that file to /etc/manpaths.d doesn't actually do any good (at least not on El Capitan).

This is presumably because the man command on macOS does a lot of work trying to find man pages in the "appropriate" place, based on where the commands themselves are found.  See SEARCH PATH FOR MAN PAGES in

	https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/man.1.html

or, if you have a machine running macOS (under any of its names...), in the man page for the man command.

We might want to put the commands and man pages into the app bundle in a layout with "bin" and "man" directories, such as

	Wireshark.app/Contents/{bin,man}

or

	Wireshark.app/Contents/usr/{bin,man}

and put the paths into /etc/paths.d and /etc/manpaths.d.  That might not fix the problem for section 4 man pages, but it would at least fix them for section 1 man pages - and might also mean we wouldn't need to put the wrapper scripts (or anything else) into /usr/local/bin.