memo.xight.org

日々のメモ

Macのmanの日本語化

Summary

標準のgroffでは日本語が文字化けするため、 homebrew で groff を入れる。
あとは、man-pages-ja を入れて完了。
ja-man-doc を入れる場合は、文字コードを変換する。

groffとnkfのインストール

% brew tap homebrew/dupes
% brew install groff
% brew install nkf

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/local/bin/less -isr
BROWSER /usr/local/bin/less -isr


man-pages-ja の取得とmake

$ curl -O http://linuxjm.sourceforge.jp/man-pages-ja-YYYYMMDD.tar.gz
$ tar xfz man-pages-ja-YYYYMMDD.tar.gz
$ cd man-pages-ja-YYYYMMDD
$ make
perl -w script/configure.perl
[INSTALLATION INFORMATION]
(just Return if you accept default)
   Install directory   [/usr/share/man/ja_JP.UTF-8] ?: /usr/local/share/man/ja_JP.UTF-8
   compress manual with..
      0: none
      1: gzip
      2: bzip2
      3: compress
   select [0..3] : 3
   uname of page owner [root] ?: username
   group of page owner [root] ?: admin

   Directory:    /usr/local/share/man/ja_JP.UTF-8
   Compression:  compress
   Page uid/gid: username/admin

All OK? (Yes, [C]ontinue / No, [R]eselect) : c

[INSTALL PACKAGE SELECTION]
(just Return if you accept default choice)
(you can change the default by editing script/pkgs.list)
   [ 0/118] shadow          [Y/n] ?: 
   [118/118] zebedee         [Y/n] ?: 
All OK? (Yes, [C]ontinue / No, [R]eselect) : c

[RESOLVE CONFLICTS]
(just Return if you accept item 0)
   [0/170] There are 2 pages for arch.1:
    0: in GNU_coreutils
    1: in util-linux
   Which to install? (0..1) : 

   [169/170] There are 2 pages for yes.1:
    0: in GNU_coreutils
    1: in gnumaniak
   Which to install? (0..1) : 
   GNU_coreutils/yes:1 is selected.

All OK? (Yes, [C]ontinue / No, [R]eselect) : c

creating installation script...done
now you can "make install" as user username.

$ make install

ja-man-doc

$ curl -O http://home.jp.freebsd.org/~kogane/JMAN9/ja-man-doc-9.X.YYYYMMDD.tbz

$ tar xfj ja-man-doc-9.X.YYYYMMDD.tbz
$ cd ja-man-doc-9.X.YYYYMMDD.tbz/share/man
$ gunzip -fr ./

$ find ja -name '*.[0-9]' -exec nkf --overwrite -w '{}' ';'
$ find ja -name '*.[0-9]' -exec gzip '{}' ';'

$ mv ja /usr/local/share/man/

Reference

Linux Documentaion Project - マニュアルアーカイブのダウンロード (Japanese)
http://linuxjm.sourceforge.jp/download.html

ja-man-doc
http://home.jp.freebsd.org/~kogane/

via

Macとかの雑記帳 - 2012-09-26 - jmanを使わずにMacのmanを日本語化する方法
http://tukaikta.blog135.fc2.com/blog-entry-224.html