mac 安装 man 中文手册

安装 man 中文手册

在使用 mac 或者 linux 的时候,需要用到命令,而大量的命令含有大量 options,一般很难记住,使用 man 可以查看这些命令的 options,但对于英语薄弱的人来说,例如我,看起来还是有一定的困难,所以需要安装以下中文手册。
准备前,我们需要安装两个 package,前提你是使用了 brew 管理

1
2
> brew install automake
> brew install opencc

然后需要下载中文包。

1
2
3
4
5
6
> git clone  https://github.com/man-pages-zh/manpages-zh
> cd manpages-zh
> autoreconf --install --force
> ./configure
> sudo make
> sudo make install

等待编译完成之后,我们还需要配置一些东西。如果你之前没有更新 groff,需要先更新 groff,不然会出现乱码。

1
2
3
4
5
> brew install groff 
> echo "MANPATH /usr/local/share/man/zh_CN" >> /etc/man.conf
> echo "NROFF preconv -e UTF8 | /usr/local/bin/nroff -Tutf8 -mandoc -c" >> /etc/man.conf
> export alias cman='man -M /usr/local/share/man/zh_CN' // 你可以加入到环境变量里
> cman ls

这样就可以愉快的使用 man 中文手册啦