LoginSignup
2
6

More than 5 years have passed since last update.

SierraにKHCoderをインストールしたときのメモ

Last updated at Posted at 2017-10-01

背景

テキストマイニングのためのフリーソフトウェアとして有名なKH Coderをインストールしたときのメモです。
デファクトスタンダードは、Windowsにインストールするのですが、perlとRとTKで動いているためクロスプラットフォームで動きます。自分はMacしか持っていなかったため、Macにインストールしました。

環境

OS: 10.12.3(Sierra)
shell: bash

インストール

KH CoderをMacにインストール
=> perl以外はこっちがオススメ

Mac】KH Coder導入手順
=> perlのインストールは、cpanmを使ったこっちがオススメ

brewで失敗することはなく、perlのモジュールをインストールしたときに失敗しました。
perl -MCPAN -e shellではTK, Clipboardが失敗したため、cpanmでインストールしたらうまくインストール出来た記憶があり
ます。makeとかはしなくても動きました。

また、一度失敗しても、cpanm Clipboard --forceなどと--forceをつけると動く場合があります。

どうしてもインストールできない場合は、公式に有償サポートがありますので、こちらを使うと早いと思います。
=> Macで手軽にKH Coderを[有償サポート]

※ インストール時は言語環境がUTF8でも問題ないです。

X Winodow Systemについて

kh_coderの起動にはX Winodow Systemが必要です。Macでは、xquartzというアプリケーションでX Window Systemが使えます。ここからdmgファイルをダウンロードしインストールします。
インストールするとターミナルの中でstartxコマンドが使えるようになります。

kh_coderを起動する

kh_coderはターミナルから起動します。ターミナルのデフォルト言語環境はUTF8です。kh_coderはSJISの環境で起動する必要があるため、ターミナルの言語環境をSJISに変更してから起動してください。

貼り付けた画像_2017_10_01_23_04.png

X Window Systemを起動する

kh_coderを起動するには、xwindowを事前に起動する必要があるためstartxコマンドを実行します。

startx

出力結果

正常時

This is KH Coder 2.00f on darwin.
CWD: /Applications/kh_coder
R Version: 3.3, x86_64
Using un-threaded functions...

文字コードは間違っていると、起動はしますが、下記のエラーが出ます。

font_cache: Scanning user font directories to generate X11 font caches
font_cache: Updating FC cache
font_cache: Done
expr: syntax error
expr: syntax error
expr: syntax error
xauth:  file /Users/xxxxx/.serverauth.94212 does not exist
xauth: (argv):1:  bad display name "xxxxxx.local:0" in "list" command
xauth: (stdin):1:  bad display name "xxxxxx.local:0" in "add" command

/opt/X11/bin/xinit: XFree86_VT property unexpectedly has 0 items instead of 1

※: xxxxxxは、自分のフォルダー名/PC名なのでマスクした

kh_coderを起動する

perl kh_coder.pl

下記のWindowが開けば成功です。
image.png

kh_coderが起動しない場合

X Window Systemが起動していないとperk kh_coder.plを実行したときに下記のエラーが出力されます。
ターミナルの言語環境はSJISに設定しstartxコマンドを実行しましょう。

This is KH Coder 2.00f on darwin.
CWD: /Applications/kh_coder
sh: line 1: 94387 Killed: 9               /usr/local/bin/R --slave --vanilla < start.r > output.log
R Version: 3.3, x86_64
Using un-threaded functions...
couldn't connect to display ":0" at /Library/Perl/5.18/darwin-thread-multi-2level/Tk/MainWindow.pm line 53.
MainWindow->new() at /Applications/kh_coder/kh_lib/gui_window.pm line 117.
Warning message:
In Sys.setlocale(category = "LC_ALL", locale = "ja_JP.EUC-JP") :
  OS reports request to set locale to "ja_JP.EUC-JP" cannot be honored
2
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
6