macでインストールする方法はMacPort?を使うと楽。ほかにも入れる方法はあると思うけど
port install nkf
ファイルのエンコーディングを調べる方法
$ nkf --guess hoge.txt