On Unix-like systems including macOS, manual pages are typically stored in standard locations following the Filesystem Hierarchy Standard. The primary directories are:
/usr/share/man
/usr/local/man
/usr/X11/man
/opt/local/share/man (for MacPorts)
/usr/local/opt/[package]/share/man (for Homebrew)
To search where existing man pages are stored:
# Search system-wide
find /usr -name "man*" -type d 2>/dev/null
# Search common locations
ls -d /usr/local/man/man* /usr/share/man/man*
For manually installing iftop's man page (or any package from source), the correct location would be:
/usr/local/share/man/man8/iftop.8 # For section 8 (system admin commands)
# OR
/usr/local/man/man8/iftop.8
If your $MANPATH is empty, macOS uses compiled-in defaults. To verify:
manpath
To permanently add custom man page locations:
# Add to ~/.zshrc or ~/.bashrc
export MANPATH="/usr/local/man:/usr/local/share/man:$MANPATH"
After copying the man page, rebuild the whatis database:
sudo /usr/libexec/makewhatis
Verify the man page can be found:
man -w iftop
For common package managers:
- Homebrew: /usr/local/opt/[package]/share/man
- MacPorts: /opt/local/share/man
- Fink: /sw/share/man
Complete procedure when compiling from source:
# Assuming iftop source contains iftop.8
sudo mkdir -p /usr/local/share/man/man8
sudo cp iftop.8 /usr/local/share/man/man8/
sudo chmod 644 /usr/local/share/man/man8/iftop.8
sudo makewhatis
On macOS, man pages are typically stored in the following standard locations, which are automatically indexed by the man
command:
/usr/share/man
/usr/local/share/man
/usr/X11/share/man
For custom installations (like your iftop case), /usr/local/share/man
is the most appropriate location as it's designated for user-installed software.
When echo $MANPATH
returns empty, it means the system will use its default search paths. You can view these with:
manpath
This will display the complete search path including all default directories.
For your iftop installation, follow these steps:
# First, locate the man page in your source directory
find ~/iftop-source -name "iftop.1" -o -name "iftop.8"
# Then copy it to the appropriate location
sudo cp iftop.1 /usr/local/share/man/man1/
If the manual section isn't clear (1 vs 8), you can check with:
man ./iftop.1 # Test viewing locally first
After copying, rebuild the manual database:
sudo mandb
Or alternatively on older macOS versions:
sudo /usr/libexec/makewhatis /usr/local/share/man
If man still can't find your page, explicitly set MANPATH in your shell config:
echo 'export MANPATH="/usr/local/share/man:$MANPATH"' >> ~/.zshrc
source ~/.zshrc
For better management, consider using Homebrew:
brew install iftop
This handles man page installation automatically and ensures proper paths.