事象
Vim のマニュアルを見ようと思ったら、groff のエラーが出た
$ man vim
/usr/bin/groff: can't find `DESC' file
/usr/bin/groff:fatal error: invalid device `nippon'
原因
- Vim をインストールした時に、日本語のマニュアルを表示するように設定されていたらしい
- その日本語マニュアルの表示に、 groff というものを使っていたらしい
- groff というコマンドが、日本語対応していないらしい
対処
groff を日本語対応させる!
# groff をインストール
$ brew install groff
# groff があることを確認
$ which groff
/usr/local/bin/groff
設定ファイルを書き換え
$ sudo vim /etc/man.conf
man.conf 以下の箇所を書き換える
# 修正前
JNROFF /usr/bin/groff -Tnippon -mandocj -c
# 修正後
JNROFF /usr/local/bin/groff -Dutf8 -Tutf8 -mandoc -mja -E
# 修正前
PAGER /usr/bin/less -is
BROWSER /usr/bin/less -is
# 修正後
PAGER /usr/bin/less -isr
BROWSER /usr/bin/less -isr
結果
$ man vim
VIM(1) General Commands Manual VIM(1)
名前
vim - Vi IMproved, プログラマのテキストエディタ
他の man も日本語対応させる
# ダウンロード
# 日付の部分は、http://linuxjm.osdn.jp/download.html を見て最新版を指定する
$ curl -O http://linuxjm.osdn.jp/man-pages-ja-20201215.tar.gz
# 解凍(日付の部分は適宜変更)
$ tar xfz man-pages-ja-20201215.tar.gz
# 解凍終わったのでアーカイブを削除
$ rm man-pages-ja-20201215.tar.gz
$ cd man-pages-ja-20201215/
$ make config
# インストール先の指定:/usr/local/share/man/ja_JP.UTF-8 を入力
Install directory [/usr/share/man/ja_JP.UTF-8] ?: /usr/local/share/man/ja_JP.UTF-8
# 圧縮形式の選択:0 を入力
compress manual with..
0: none
1: gzip
2: bzip2
3: compress
select [0..3] : 0
# ユーザー名:root を入力
uname of page owner [root] ?: root
# グループ名:wheel を入力
group of page owner [root] ?: wheel
# 確認:c を入力する
All OK? (Yes, [C]ontinue / No, [R]eselect) : c
# インストールするマニュアルの選択:今回は全部入れたいので、[120/120]になるまで Enter 長押し
[INSTALL PACKAGE SELECTION]
(just Return if you accept default choice)
(you can change the default by editing script/pkgs.list)
[ 0/120] shadow [Y/n] ?:
# 確認:c を入力する
$ All OK? (Yes, [C]ontinue / No, [R]eselect) : c
# [166/166]になるまで Enter 長押し
[RESOLVE CONFLICTS]
(just Return if you accept item 0)
[0/166] There are 2 pages for basename.1:
0: in GNU_coreutils
1: in gnumaniak
Which to install? (0..1) :
# 確認:c を入力する
All OK? (Yes, [C]ontinue / No, [R]eselect) : c
# 完了!
creating installation script...done
now you can "make install" as user root.
# マニュアルのインストール
$ sudo make install
done.
# マニュアルが格納されたことを確認する
$ ls -la /usr/local/share/man/ja_JP.UTF-8/
# お試し
$ man ls
LS(1) ユーザーコマンド LS(1)
名前
ls - ディレクトリの内容をリスト表示する
日本語になった!ヤッター