w3m (CUIブラウザ) をMacにインストール
以前から気になっていた、CUIブラウザの「w3m」をMacにインストールして遊んでみました。
MacPorts で w3m をインストール
「w3m」は MacPorts からのインストールが可能になっているので、「port」コマンドでインストールします。
MacPorts のインストールについては、SnowLeopardにMacPortsをインストール soi33.org などが参考になると思います。
「sudo port install w3m」というコマンドを実行して「w3m」をインストールします。
(各種ツールのダウンロードとビルドが実行されるため、そこそこ時間がかかります。)
$ sudo port install w3m Password: ---> Computing dependencies for w3m ---> Fetching boehmgc ---> Attempting to fetch gc-7.1.tar.gz from http://distfiles.macports.org/boehmgc ---> Verifying checksum(s) for boehmgc ---> Extracting boehmgc ---> Configuring boehmgc ---> Building boehmgc ---> Staging boehmgc into destroot ---> Installing boehmgc @7.1_0+darwin_10 ---> Activating boehmgc @7.1_0+darwin_10 ---> Cleaning boehmgc ---> Fetching expat ---> Attempting to fetch expat-2.0.1.tar.gz from http://nchc.dl.sourceforge.net/expat ---> Verifying checksum(s) for expat ---> Extracting expat ---> Configuring expat ---> Building expat ---> Staging expat into destroot ---> Installing expat @2.0.1_0 ---> Activating expat @2.0.1_0 ---> Cleaning expat ---> Fetching gperf ---> Attempting to fetch gperf-3.0.4.tar.gz from ftp://ftp.dti.ad.jp/pub/GNU/gperf ---> Verifying checksum(s) for gperf ---> Extracting gperf ---> Configuring gperf ---> Building gperf ---> Staging gperf into destroot ---> Installing gperf @3.0.4_0 ---> Activating gperf @3.0.4_0 ---> Cleaning gperf ---> Fetching libiconv ---> Attempting to fetch libiconv-1.13.1.tar.gz from ftp://ftp.dti.ad.jp/pub/GNU/libiconv ---> Verifying checksum(s) for libiconv ---> Extracting libiconv ---> Applying patches to libiconv ---> Configuring libiconv ---> Building libiconv ---> Staging libiconv into destroot ---> Installing libiconv @1.13.1_0 ---> Activating libiconv @1.13.1_0 ---> Cleaning libiconv ---> Fetching ncursesw ---> Attempting to fetch ncurses-5.7.tar.gz from ftp://ftp.dti.ad.jp/pub/GNU/ncurses ---> Verifying checksum(s) for ncursesw ---> Extracting ncursesw ---> Configuring ncursesw ---> Building ncursesw ---> Staging ncursesw into destroot ---> Installing ncursesw @5.7_0+darwin_10 ---> Activating ncursesw @5.7_0+darwin_10 ---> Cleaning ncursesw ---> Fetching ncurses ---> Verifying checksum(s) for ncurses ---> Extracting ncurses ---> Configuring ncurses ---> Building ncurses ---> Staging ncurses into destroot ---> Installing ncurses @5.7_0+darwin_10 ---> Activating ncurses @5.7_0+darwin_10 ---> Cleaning ncurses ---> Fetching gettext ---> Attempting to fetch gettext-0.17.tar.gz from ftp://ftp.dti.ad.jp/pub/GNU/gettext ---> Verifying checksum(s) for gettext ---> Extracting gettext ---> Applying patches to gettext ---> Configuring gettext ---> Building gettext ---> Staging gettext into destroot ---> Installing gettext @0.17_4 ---> Activating gettext @0.17_4 ---> Cleaning gettext ---> Fetching zlib ---> Attempting to fetch zlib-1.2.5.tar.bz2 from http://distfiles.macports.org/zlib ---> Verifying checksum(s) for zlib ---> Extracting zlib ---> Applying patches to zlib ---> Configuring zlib ---> Building zlib ---> Staging zlib into destroot ---> Installing zlib @1.2.5_0 ---> Activating zlib @1.2.5_0 ---> Cleaning zlib ---> Fetching openssl ---> Attempting to fetch openssl-0.9.8n.tar.gz from http://distfiles.macports.org/openssl ---> Verifying checksum(s) for openssl ---> Extracting openssl ---> Applying patches to openssl ---> Configuring openssl ---> Building openssl ---> Staging openssl into destroot ---> Installing openssl @0.9.8n_0+darwin ---> Activating openssl @0.9.8n_0+darwin ---> Cleaning openssl ---> Fetching w3m ---> Attempting to fetch w3m-0.5.2.tar.gz from http://nchc.dl.sourceforge.net/w3m ---> Verifying checksum(s) for w3m ---> Extracting w3m ---> Applying patches to w3m ---> Configuring w3m ---> Building w3m ---> Staging w3m into destroot ---> Installing w3m @0.5.2_1 ---> Activating w3m @0.5.2_1 ---> Cleaning w3m
w3m 使ってみる (簡単に)
「w3m」のインストールが完了したら、さっそく使ってみます。
「w3m 開きたいページのURL」の形式でコマンドを事項します。
Googleのページを開く場合は、以下のようになります。
$ w3m http://www.google.co.jp/
「カーソルキー(↑↓←→)またはhjklキー」でカーソル移動、「tabキー」でリンクの移動ができます。
テキストボックスに入力する際は「aキー または Enterキー」で入力開始ができます。
入力後は「Enterキー」で入力完了ができます。
実際に検索キーワードに「hogehoge」と入力して、検索を行うと以下のように検索結果画面が表示されました。
検索結果から Wikipedia のページを開いてみるとこんな感じになります。
「T(大文字T Shift+tとか)」を打つと、新しいタブを開くこともできます。
タブの移動は「{ → 前のタブへ移動」「} → 後のタブへ移動」で可能です。
タブで新しいURLのページを開く場合は、「「U(大文字U Shift+uとか)」」で新規にURLを入力してページを開くことができます。
その他の詳しい操作方法については、w3m のヘルプを見るのが良いです。
ヘルプは「H(大文字H Shift+hとか)」で開く事ができます。
ヘルプはページとして開く事ができるので、操作に慣れないうちはタブでヘルプを開きつつ、色々と試すのがやり安いと思いました。
操作方法としてはVimとかEmacsとかに似ているような感じなので、FirefoxのVimperatorとかを使っている人なら意外とハマるかもしれません。
(私もまだまだ深く試せてはいませんが。)
今回参考にしたページ
w3m の使い方 (よく使うキー操作)
http://johnen.shinshu-u.ac.jp/~matsu/lectures/cl/w3m-key-bindings.html
テキストブラウザ(w3m)
http://airknights.fumimi.com/freebsd/japanese/w3m.php
メスクリンblog MacPorts
http://mesklin.blog113.fc2.com/?mode=m&no=7
SnowLeopardにMacPortsをインストール soi33.org
http://blog.soi33.org/archives/17