LoginSignup
2
1

More than 5 years have passed since last update.

plenvでPerl環境の構築 (with homebrew)

Posted at

目的

アプリケーションを動かすのに、Perlのモジュールをインストールする必要があった
もともと入っていたPerlはバージョンが古すぎてアプリケーションが動かなかった
ついでに新しめのバージョンにしてみた

普段はPerlはあんまり使っていない
何をやったか(やらかしたか)のメモ

マシン環境

Mac mini(2018)
Mac OS Mojave

手順

plenvをHomebrewでインストール

$ brew update
$ brew install plenv

perl-buildはhomebrewで入れない(エラーになる)

$ git clone git://github.com/tokuhirom/Perl-Build.git ~/.plenv/plugins/perl-build/

Homebrewが以下を.bash_profileに書き加えろ、と指示してきたのでその通りにした。

if which plenv > /dev/null; then eval "$(plenv init -)"; fi

cpanmのインストール

$ brew install cpanminus

この後、brewでインストールしたcpanmを一度アンインストールして、
plenvでインストールし直したらモジュールの移植ができなかったので、
改めてbrewでインストールをし直した

.bash_profileに以下を追加(homeフォルダにlocalという新しいフォルダができる)

export PERL_CPANM_OPT="--local-lib=~/local/lib/perl5"
export PERL5LIB=$HOME/local/lib/perl5/lib/perl5:$PERL5LIB;

Perl別バージョンのインストール

5.29.10が最新だったけど、あえて安定性を考えて一つ前にしてみた

$ plenv install 5.28.2

plenv versions
* system (set by /Users/hoge/.plenv/version)
  5.28.2

有効バージョンの変更

$ plenv global 5.28.2
$ plenv versions
  system
* 5.28.2 (set by /Users/hoge/.plenv/version)

systemのperlに入れていたモジュールを移植

$ plenv migrate-modules system 5.28.2

やってみて思ったこと

  • plenvとhomebrewが混在している感がある
  • 動けばいいのだけど、バージョン依存だと後で面倒?
  • また気がついたら追記
2
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
2
1