zshをMacPortsでアップデートする
zshは、以下のコマンドでバージョン確認ができます。
% zsh --version zsh 4.3.4 (powerpc-apple-darwin9.0)
現在のバージョン(最初からMacに入っていたもの)は4.3.4ですね。
% port search zsh [~] ctags @5.7 (devel) Reimplementation of ctags(1) lesspipe @1.53 (textproc) lesspipe is an input filter for the pager less. zsh @4.2.7 (shells) Zsh is a UNIX command interpreter (shell) zsh-devel @4.3.9 (shells) Zsh is a UNIX command interpreter (shell) Found 4 ports.
4.3.9というバージョンが見つかりました。今のバージョンより新しいので、アップデートしましょう。
% sudo port install zsh-devel [~] Password: ---> Fetching gdbm ---> Attempting to fetch gdbm-1.8.3.tar.gz from ftp://ftp.dti.ad.jp/pub/GNU/gdbm ---> Verifying checksum(s) for gdbm ---> Extracting gdbm ---> Applying patches to gdbm ---> Configuring gdbm ---> Building gdbm ---> Staging gdbm into destroot ---> Installing gdbm @1.8.3_1 ---> Activating gdbm @1.8.3_1 ---> Cleaning gdbm ---> Fetching zsh-devel ---> Attempting to fetch zsh-4.3.9.tar.bz2 from ftp://ftp.iij.ad.jp/pub/misc/zsh/ ---> Attempting to fetch zsh-4.3.9.tar.bz2 from http://internap.dl.sourceforge.net/zsh ---> Verifying checksum(s) for zsh-devel ---> Extracting zsh-devel ---> Configuring zsh-devel ---> Building zsh-devel ---> Staging zsh-devel into destroot ---> Installing zsh-devel @4.3.9_0 ---> Activating zsh-devel @4.3.9_0 ---> Cleaning zsh-devel
無事インストールできました。
MacPortsでインストールしたものは/opt/local以下に入るので、インストールしたzshの場所は/opt/local/bin/zshになります。
ちょっと実験。
% whereis zsh [~] /bin/zsh % /bin/zsh --version [~] zsh 4.3.4 (powerpc-apple-darwin9.0) % zsh --version [~] zsh 4.3.9 (i386-apple-darwin9.6.0) % /opt/local/bin/zsh --version [~] zsh 4.3.9 (i386-apple-darwin9.6.0)
あれ、zsh --versionと/bin/zsh --versionの挙動が違うのはなぜ?
よくわからないけど、とりあえずログインシェルをMacPortsでインストールした/opt/local/bin/zshに変更しておきます。
% chsh -s /opt/local/bin/zsh [~] Changing shell for ama-ch. Password for ama-ch: chsh: /opt/local/bin/zsh: non-standard shell
あれ、エラーだ。ノンスタンダードシェルとか言われます。
"non-standard shell"でぐぐったら一発でした。Macportsでインストールしたzshにchshする方法 - Hello, world! - s21gにやり方が書かれていました。
% cat /etc/shells [~] # List of acceptable shells for chpass(1). # Ftpd will not allow users to connect who are not using # one of these shells. /bin/bash /bin/csh /bin/ksh /bin/sh /bin/tcsh /bin/zsh /opt/local/bin/zsh # これを追加 % chsh -s /opt/local/bin/zsh [~] Changing shell for ama-ch. Password for ama-ch:
ターミナルを再起動し、
% finger ama-ch [~] Login: ama-ch Name: ama-ch Directory: /Users/ama-ch Shell: /opt/local/bin/zsh On since 木 1 8 19:00 (JST) on console, idle 1 day 16:55 (messages off) On since 土 1 10 11:45 (JST) on ttys000 (messages off) On since 木 1 8 19:19 (JST) on ttys001, idle 2:45 No Mail. No Plan. % /opt/local/bin/zsh --version [~] zsh 4.3.9 (i386-apple-darwin9.6.0)
"Shell:"がログインシェルです。
Shell: /opt/local/bin/zshとなっているので大丈夫そうです!
あとは
% sudo port upgrade installed