FreeBSD 14.1 RELEASE - 基本設定 - 日本語 man

クラウディア 
1. 概要
2. インストール
3. /etc/manpath.config の作成
4. ~/.cshrc の編集

1. 概要

 日本の有志による、日本語「man」をインストールして、「UTF-8」で表示させる設定です。  本ページは、下記のサイトを参考にさせていただきました。
FreeBSDで日本語環境(UTF-8対応)を整える」
「FreeBSD 日本語表示に対応させる設定手順

2. インストール

 「japanese-groff」をインストールします。  「groff」には、「textproc/groff」と「japanese/groff」とがあり、もしかしたら、既に「textproc/groff」がインストールされている場合、競合が発生します。  念のため、「textproc/groff」をアンインストールしてから「japanese/groff」をインストールします。  「textproc/groff」のアンインストール。

cd /usr/ports/textproc/groff
make deinstall clean
 「japanese-groff」のインストール。  オプションは、デフォルトのままにしています。

cd /usr/ports/japanese/groff/
make
make install
 後は、以下の順にインストールしていきます。

/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/local/share/man
MANPATH_MAP /usr/bin /usr/local/share/man
MANPATH_MAP /usr/bin /usr/local/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」コマンドを使用して、マニュアル表示できるようになります。
ハイスピードプラン世界最大級のオンライン英会話EF English LiveU-NEXT