manpath 异常:`man -k .` 在 macOS 中显示重复且部分缺失

manpath 异常:`man -k .` 在 macOS 中显示重复且部分缺失

我在man -k .or中遇到了异常的 manpath apropos .

  1. 重复演出:

    $ man -k . | grep -w apropos
    man(1), apropos(1), whatis(1) - display online manual documentation pages
    man(1), apropos(1), whatis(1) - display online manual documentation pages
    
    $ man -k . | wc -l
    15256
    $ man -k . | sort -u | wc -l
    11457
    

    在此处输入图片描述

  2. 某些手册页可以通过 显示man <name>但无法通过 进行过滤man -k .,例如:

    $ man fzf | sed -r '/^\s*$/d' | head -3
    fzf(1)                 fzf - a command-line fuzzy finder                fzf(1)
    NAME
           fzf - a command-line fuzzy finder
    
    $ man -k . | grep fzf
    
    # can be found in `/usr/local/share/man`
    $ fd --glob "*fzf*" /usr/local/share/man
    /usr/local/share/man/man1/fzf-tmux.1
    /usr/local/share/man/man1/fzf.1
    

    在此处输入图片描述

这里是环境:

# /etc/man.conf
$ cat /etc/man.conf | sed -r '/^(#.*)$/d;/^\s*$/d'
MANPATH     /usr/share/man
MANPATH     /usr/local/share/man
MANPATH     /usr/X11/man
MANPATH     /Library/Apple/usr/share/man
MANSECT     1:1p:8:2:3:3p:4:5:6:7:9:0p:tcl:n:l:p:o

# /etc/manpaths
$ command cat /etc/manpaths
/usr/share/man
/usr/local/share/man

$ [[ -z $MANPATH ]] && echo '$MANPATH is empty' || echo $MANPATH
$MANPATH is empty

# manpath
$ manpath | tr ':' '\n'
/Users/marslo/perl5/man
/Users/marslo/.local/share/man
/usr/local/Cellar/[email protected]/71.1/share/man
/usr/local/vim/share/man
/Applications/MacVim.app/Contents/man
/usr/local/opt/llvm/share/man
/usr/local/opt/util-linux/share/man
/usr/local/opt/gnu-getopt/share/man
/usr/local/opt/binutils/share/man
/usr/local/opt/ruby/share/man
/usr/local/opt/tcl-tk/share/man
/usr/local/Cellar/node/21.1.0/share/man
/usr/local/Cellar/openjdk/21.0.2/libexec/openjdk.jdk/Contents/Home/man
/usr/local/opt/ed/share/man
/usr/local/opt/git-extras/share/man
/usr/local/opt/gettext/share/man
/usr/local/opt/file-formula/share/man
/usr/local/opt/openldap/share/man
/usr/local/opt/curl/share/man
/usr/local/opt/openssl/share/man
/usr/local/opt/libiconv/share/man
/usr/local/opt/sqlite/share/man
/usr/local/share/man
/usr/local/man
/usr/share/man
/Library/Apple/usr/share/man
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/share/man
/Applications/Xcode.app/Contents/Developer/usr/share/man
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man

垃圾箱:

$ type apropos; which -a apropos
apropos is hashed (/usr/bin/apropos)
/usr/bin/apropos

$ type man; which -a man
man is hashed (/usr/bin/man)
/usr/bin/man

操作系统:

$ sw_vers
ProductName:        macOS
ProductVersion:     14.3
BuildVersion:       23D56

相关内容