1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

apple インストールの perl バージョン切り替え方法

Last updated at Posted at 2015-03-17

perlbrew やら plenv が一般化してるこのご時世に、古いメモから。

デフォルトの /usr/bin/perl のバージョン切り替え方法

5.16 を使う。

defaults を飛ばす。

システムレベル

$ sudo defaults write /Library/Preferences/com.apple.versioner.perl Version 5.16

ユーザーレベル

$ defaults write com.apple.versioner.perl Version 5.16
  • ~/Library/Preferences/ にファイルが出来る。

環境変数を飛ばす。

$ export VERSIONER_PERL_VERSION=5.16 

上記の方法は、それぞれ別々。余計なファイルが作成されないから、環境変数の方がお勧め
どちらかを実行した後に、

$ perl -v

すれば切り替わってるのが分かる。

32bit 版の呼び出し方とかも perldoc perlmacosx1

PERL5LIB とか

当然、使用するライブラリも制御下にある。
つー事で、

$ perl -le 'print Dumper \@INC' -MData::Dumper 
$VAR1 = [
          '/Library/Perl/5.16/darwin-thread-multi-2level',
          '/Library/Perl/5.18/darwin-thread-multi-2level',
          '/Library/Perl/5.16',
          '/Library/Perl/5.18',
          ...

こんな状態は正直恥かしい。


2021/03/08 追記

この元のメモを投げたのが 2015/03/17 らしい。
その時点でも古いメモなのに、6 年経て、OS も macOS Big Sur となっているが、相変わらずこのギミックは存続している。
ちなみに、入っているのは、

$ ls | grep perl
(前略)
perl
perl5.18
perl5.28
perl5.30
(略)

・・・正直、ディスクの無駄だと思う、、、


  1. 2021/03/08 追記: Big Sur の 5.18 perlmacosx だと 32-bit 版のインストール方法になってるな。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?