« Movable Type Cutline Theme | Home | 用 curl 抓中央氣象局的衛星雲圖回來看 »
August 7, 2009
Install perl to $HOME
Since Perl 5.10.1 RC1 is out, it’s time to build my new shiny Perl!
I installed perl inside my $HOME directory ( /Users/gugod ), and here’s the way to do it:
cd ~/src; tar xzf perl-5.10.1-RC1.tar.gz
cd perl-5.10.1-RC1
perl Configure -de -Dprefix=${HOME}/local
make
make test
make install
The -Dprefix=${HOME}/local makes it install to ~/local. Then you’ll find the perl executable at ~/local/bin/perl. Therefore I also add ~/local/bin to my PATH:
export PATH=${HOME}/local/bin:${PATH}
Why am I doing that ? Mostly because that it doesn’t require “sudo” when installing cpan modules with cpan or cpanp command. Therefore, if I need to move my $HOME to another machine (eg, when I buy a new Mac), it’s much more easier - I’ll just have to rsync my ~/local.
It’s also useful when it’s too much trouble upgrading system perl, or when you don’t really want to upgrade system perl, but want to play with those shiny Perl 5.10 features.
Update: chas.owens pointed out that one of the Cwd test will fail if the perl is building in /tmp, because /tmp is really /private/tmp on OSX. I modified this post to use ~/src as my building path.
No TrackBacks
TrackBack URL: http://gugod.org/mt/mt-tb.cgi/231
Nice! And I see that autodie has been added to the core
At least on OS X 10.5, building in /tmp is not a good idea. The cwd test throws an error (because /tmp is really /private/tmp). Building in ~/src worked a lot better for me.
Thanks for pointing that out, I did see that Cwd test error but I simply ignored it ;)