Chinese man Mac Configuration Guide

View information about your computer's man

View a list of the manual have been loaded man

man -aw 

View an instruction manual in which a man, to the man listed match the list. By way of example ls.

man -aw ls

Chinese manual address

Chinese man pages plan https://github.com/man-pages-zh/manpages-zh

Build dependencies

Construction dependence comprising:
the autotools (autoconf, automake)
to python3
opencc 1.x

Because in MacOS, you will find that it is usually some variant of Python 2.7.x, 2.7.4 or 2.7.10 or may be similar.
Python installed two will co-exist without conflict.
So feel free to make use of Homebrew install the updated Python 3, the default version of Python preinstalled with Mac OS 2.7 and Mac OS X installation will remain completely unaffected, and can use a simple "python" command to run python3 --version View version.
You can also use 'which' or 'whereis' command to find each python version is installed.

Environment Installation

brew install python3

It will automatically downloading dependencies: gdbm, [email protected], readline, sqlite and xz

Python installed in / usr / local / bin / python3

Part of the problem because the version command python, python-config, piphas been linked respectively to the python3, python3-config, pip3and so on, each mounted to the directory / usr / local / opt / python / libexec / bin
specific view https://docs.brew.sh/Homebrew-and-Python

Screen shot 2019-11-13 7.06.53 PM

brew install autoconf
brew install automake

Screen shot 2019-11-13 7.11.19 PM

brew install opencc

Get Chinese manual

The project download:
git clone https://github.com/man-pages-zh/manpages-zh.git

cd manpages-zh
autoreconf --install --force
./configure
make
sudo make install

Can you see the Chinese document has been loaded

man -aw

/usr/local/share/man:/usr/share/man:/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/share/man:/Library/Developer/CommandLineTools/usr/share/man # 可以看到没有加载

Adding manual path

Check the manual that can be done adding path is loaded again

sudo vim /etc/man.conf
 
 
...
MANPATH /usr/local/X11/man              #line 44
MANPATH /usr/local/share/man/zh_CN        #添加中文手册路径
...
 
 
:wq

man -aw
/usr/local/share/man:/usr/share/man:/usr/local/share/man/zh_CN:/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/share/man:/Library/Developer/CommandLineTools/usr/share/man # 中文手册已经加载

Alias ​​added to zsh (can not happen)

echo "alias cman='man -M /usr/local/share/man/zh_CN'" >> ~/.zshrc
source ~/.zshrc

Or yourself with vim editor, specifically to see how their own operations.
At this point you can see at a cman ls is not Chinese, and if so on it. If you need to continue garbled.

Solve the garbage

If groff version of the system is too low, the document may be garbled, you can update to the latest version of groff
Screen shot 2019-11-13 8.25.07 PM

You can see the lower system version, so

brew install groff

After installation is complete, the configuration man.conf

sudo vim /etc/man.conf
 
...
#修改NROFF配置如下(将UTF8编码的MAN页面通过转码而被groff识别)
#line 95
 
NROFF preconv -e utf8 | /usr/local/bin/groff -Wall -mtty-char -Tutf8 -mandoc -c  
 
...
 
#修改PAGER配置如下(这样可以避免MAN手册页面中的ANSI Escape字符序列干扰(用于控制显示粗体等格式))
#line 106
 
PAGER /usr/bin/less -isR
...
 
:wq

end

After testing, we can finally see the Chinese manual. But mac touch screen bar still using the system comes with MacOS, so the alias of very convenient direct input cman ls ls can view the Chinese document.

Guess you like

Origin www.cnblogs.com/himonkey/p/11853564.html