Mac OS X に Perl 5.12 系をインストールする
いま Perl は MacPorts でインストールされた 5.8.9 を使っているが、さくらの VPS で使う Perl のバージョンを 5.12 にしたので、Mac OS X でも使えるようにしたいと考えるようになった。
1. perlbrew のインストール
% cd ~ % curl -LO http://xrl.us/perlbrew % chmod u+x perlbrew % ./perlbrew install The perlbrew is installed as: /Users/littlebuddha/perl5/perlbrew/bin/perlbrew You may trash the downloaded /Users/littlebuddha/perlbrew from now on. Next, if this is the first time you've run perlbrew installation, run: /Users/littlebuddha/perl5/perlbrew/bin/perlbrew init And follow the instruction on screen. % chmod u+x perlbrew % ./perlbrew install The perlbrew is installed as: /Users/littlebuddha/perl5/perlbrew/bin/perlbrew You may trash the downloaded /Users/littlebuddha/perlbrew from now on. Next, if this is the first time you've run perlbrew installation, run: /Users/littlebuddha/perl5/perlbrew/bin/perlbrew init And follow the instruction on screen.
ダウンロードした perlbrew は、もう削除してもいいと表示されているので、削除する。
% rm perlbrew
2. Perl 5.12.1 をインストールする
perlbrew の初期化をする。
% ~/perl5/perlbrew/bin/perlbrew init Perlbrew environment initiated, required directories are created under /Users/littlebuddha/perl5/perlbrew Well-done! Congratulations! Please add the following line to the end of your ~/.bashrc source /Users/littlebuddha/perl5/perlbrew/etc/bashrc After that, exit this shell, start a new one, and install some fresh perls: perlbrew install perl-5.12.1 perlbrew install perl-5.10.1 For further instructions, simply run: perlbrew The default help messages will popup and tell you what to do! Enjoy perlbrew at $HOME!!
perlbrew の設定をシェルに読み込ませる。
設定ファイルは bash を念頭にしているが、zsh でも問題ないだろうと決めつけて、.zshrc に追記してしまう。
けれども、念のためバックアップファイルを作っておく。
% cp ~/.zshrc ~/.zshrc.bak
.zshrc に設定を追記して、変更を反映させる。
% echo 'source ~/perl5/perlbrew/etc/bashrc' >> ~/.zshrc % source ~/.zshrc
実際にインストールをする。
% perlbrew install perl-5.12.1 Attempting to load conf from /Users/littlebuddha/perl5/perlbrew/Conf.pm Fetching perl-5.12.1 as /Users/littlebuddha/perl5/perlbrew/dists/perl-5.12.1.tar.gz Installing perl-5.12.1 into /Users/littlebuddha/perl5/perlbrew/perls/perl-5.12.1 This could take a while. You can run the following command on another shell to track the status: tail -f /Users/littlebuddha/perl5/perlbrew/build.log (cd /Users/littlebuddha/perl5/perlbrew/build; tar xzf /Users/littlebuddha/perl5/perlbrew/dists/perl-5.12.1.tar.gz;cd /Users/littlebuddha/perl5/perlbrew/build/perl-5.12.1;rm -f config.sh Policy.sh;sh Configure -de '-Dprefix=/Users/littlebuddha/perl5/perlbrew/perls/perl-5.12.1';make;make test && make install) >> '/Users/littlebuddha/perl5/perlbrew/build.log' 2>&1 Installed perl-5.12.1 as perl-5.12.1 successfully. Run the following command to switch to it. perlbrew switch perl-5.12.1 %
インストールして、Perl 5.12.1 へのパスが設定されているかも含めて確認をする。
% perlbrew list perl-5.12.1 * /opt/local/bin/perl /usr/bin/perl % perlbrew switch perl-5.12.1 % perlbrew list * perl-5.12.1 /opt/local/bin/perl /usr/bin/perl % perl -v This is perl, v5.8.9 built for darwin-2level Copyright 1987-2008, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.
あとは、実際に CPAN モジュールをインストールして、使い勝手を確認する。