p6env - Perl6 environment manager

Last year, I created yet another Perl6 environment manager, p6env. Speaking of Perl6 environment managers, I think everyone imagine rakudobrew. Yes, it is awesome.

Here are pros and cons of p6env:

  • Pros
    • p6env is one of the env family (rbenv, plenv, pyenv, etc.). So if you’re already familiar with them, you can use p6env even without any explanation.
    • You can easily write plugins for p6env. See, for example, https://github.com/skaji/p6env-update.
    • It can install rakudo-star distributions by default.
  • Cons
    • It does not support Windows.

Since I created p6env, I have been using it and like it. I hope you try it.

How to install p6env

Here, we assume you use bash as your default shell. If you use different shells, please read README at github instead.

# 1. install p6env
❯ git clone https://github.com/skaji/p6env ~/.p6env

# 2. add two lines to ~/.bash_profile
❯ echo 'export PATH="$HOME/.p6env/bin:$PATH"' >> ~/.bash_profile
❯ echo 'eval "$(p6env init -)"' >> ~/.bash_profile

# 3. install perl6-build, which is the actual implementation of "install" command
❯ git clone https://github.com/skaji/perl6-build ~/.p6env/plugins/perl6-build

# 4. restart your shell
😆

How to use p6env

Here is typical usage of p6env.

List available Perl6

❯ p6env install -l
Available versions (latest 20 versions):
 rakudo-star-2018.10
 rakudo-star-2018.06
 rakudo-star-2018.04
 rakudo-star-2018.01
 rakudo-star-2017.10
 rakudo-star-2017.07
 rakudo-star-2017.04
 rakudo-star-2017.01
 rakudo-star-2016.11
 rakudo-star-2016.10
 2018.12
 2018.11
 2018.10
 2018.09
 2018.08
 2018.06
 2018.05
 2018.04.1
 2018.04
 2018.03

Install rakudo-star or perl6 from rakudo git repository

# install rakudo-star 2018.10
❯ p6env install rakudo-star-2018.10

# install perl6 from rakudo git repository with HEAD
❯ p6env install HEAD

# Install perl6 from rakudo git repository with jvm backend
❯ p6env install --jvm HEAD

Use your Perl6

❯ p6env versions
  2018.12-125-g4a152da50
  2018.12-125-g4a152da50-jvm
  rakudo-star-2018.10

❯ p6env global rakudo-star-2018.10

❯ perl6 -v
This is Rakudo Star version 2018.10 built on MoarVM version 2018.10
implementing Perl 6.c.

Install zef into current Perl6

❯ p6env install-zef
❯ zef --help
Zef - Perl6 Module Management

That’s all. Happy hacking with p6env!

3 Comments

Tried everything out, and it works great. Thanks for your effort! But not sure what is happening to executables zef installs. Rakudobrew a rehash would have the 'cro' executable in my path after an install. I cant even find a file with that name in .p6env/ after using the zef from the environment. Is this a known limitation? The library installs fine though.

Yeah I removed the entirety of my old environment first. Its the zef and perl6 from within .p6env, the environment variables are set. I just tried installing another module with a CLI tool and it worked fine. I'll try reinstalling Cro and checking the log.

Leave a comment

About Shoichi Kaji

user-pic I blog about Perl.