1. 概要
日本の有志による、日本語「man」をインストールして、「UTF-8」で表示させる設定です。
本ページは、下記のサイトを参考にさせていただきました。
「FreeBSDで日本語環境(UTF-8対応)を整える」
「FreeBSD 日本語表示に対応させる設定手順」
2. インストール
「japanese-groff」をインストールします。
もし、今までの手順で「groff」がインストールされていれば、それをアンインストールします。
groff --version
と入力した結果が
groff: コマンドが見つかりません.
となれば、「groff」はインストールされていませんので、アンインストールの必要はありません。
「groff」の処理が終わったら、「japanese-groff」のインストール。
オプションは、デフォルトのままにしています。
cd /usr/ports/japanese/groff
make
make install
「groff --version」の結果は、2024年3月7日の時点で。
GNU groff version 1.18.1
Copyright (C) 2002 Free Software Foundation, Inc.
GNU groff comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of groff and its subprograms
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
called subprograms:
GNU troff (groff) version 1.18.1
GNU grops (groff) version 1.18.1
でした。
以降、以下の順にインストールしていきます。
/usr/ports/japanese/man
/usr/ports/japanese/man-doc
/usr/ports/misc/lv
いずれもオプションはデフォルトのままにします。
「japanese/man-doc」のインストール時のメッセージを参考までに掲載しておきます。
Installing ja-man-doc-5.4.20050911_3...
Japanese online manual has been successfully installed.
(1) To read jman(1), use the following command sequence:
% setenv LC_CTYPE ja_JP.eucJP
% setenv PAGER jless
% jman jman
(2) For more info, please visit following web page (Japanese):
Jpman project <URL:http://www.jp.FreeBSD.org/man-jp/>
(3) If you have any questions, comments, bug reports, suggestions,
and/or requests for modifications, please send e-mail to:
Jpman project mailing list <man-jp@jp.FreeBSD.org>
===> NOTICE:
The ja-man-doc port currently does not have a maintainer. As a result, it is
more likely to have unresolved issues, not be up-to-date, or even be removed in
the future. To volunteer to maintain this port, please create an issue at:
https://bugs.freebsd.org/bugzilla
More information about port maintainership is available at:
https://docs.freebsd.org/en/articles/contributing/#ports-contributing
3. /etc/manpath.config の作成
「jman」を表示するには
/etc/manpath.config
というファイルが必要です。
ファイルがないと
$ jman
jman: unable to find the file /etc/manpath.config
怒られます。
ファイルを作成して、中身を記述します。
「root」ユーザ権限で。
sh
cat << 'EOF' >> /etc/manpath.config
MANPATH_MAP /bin /usr/share/man
MANPATH_MAP /usr/bin /usr/share/man
MANPATH_MAP /usr/bin /usr/share/openssl/man
MANPATH_MAP /usr/local/bin /usr/local/man
EOF
exit
4. ~/.cshrc の編集
以下、「UTF-8」で「jman」を読めるようにする設定です。
シェルが「C」シェル系であれば
vi ~/.cshrc
以下を記述し
alias less lv
alias jman env LANG=ja_JP.eucJP jman
if ($tty =~ pts) then
setenv LANG ja_JP.UTF-8
endif
setenv PAGER lv
setenv LV '-Ou8'
source ~/.cshrc
シェルが「bash」であれば、
vi ~/.bashrc
以下を記述し
alias less='lv'
alias jman='env LANG=ja_JP.eucJP jman'
LANG=ja_JP.UTF-8; export LANG
PAGER=lv; export PAGER
LV='-Ou8' export LV
source ~/.bashrc
これで、「UTF-8」環境で「jman」コマンドを使用して、マニュアル表示できるようになります。