From my Notebook >

How to install Raku (programming language) in Ubuntu 22.04 using Rakubrew

Image: The author explores the Raku Installation Zone, an uncharted wilderness with seemingly many options, maintained on various websites.

Even though Raku & Rakudo can be installed “the normal way” in Ubuntu 22.04, via sudo apt install rakudo, this seems to have some limitations, and does not install a new version of Raku.

For these reasons, I wanted to try Rakubrew, which is a multi-platform Raku installation tool. It allows you to get the latest Raku and related tools running fairly easily.

Rakubrew Installation Steps

Here are the steps that worked best for me:

1. Run the installation script from rakubrew.org

The command to run the script:

curl https://rakubrew.org/install-on-perl.sh | sh

I ran that from a terminal window.

2. Do what the script says

Then the script said I should make sure to let Bash know that it needs to be initialized:

echo 'eval "$(/home/marc/.rakubrew/bin/rakubrew init Bash)"' >> ~/.bashrc

Note: After doing this, you should run the following command, or log out / log back in (the installer left this out):

source ~/.bashrc

3. Actually install raku!

This was a bit confusing to me, since it’s under the rather terse “How” heading on the Rakubrew website, and is easy to miss…

To actually get Raku installed, run this:

rakubrew download

Once this is complete, you’ll be able to use Raku just like in the tutorials.

Please see the “How” heading on the Rakubrew website for more tips, like switching Raku versions, and more.

4. Install modules using zef

You can install Raku modules from the terminal, using zef. It is included in the rakubrew installation.

For example, if you want to use GTK::Simple to create a simple application with a GUI:

zef install GTK::Simple

Conclusion & Additional Notes of Advice

Overall, my experience installing a new version of Raku hasn’t been terrific, but at least it eventually worked.

It would be nice if the install could be more friendly, or at least more fully-documented in some official location on the Raku website.

Why not binaries? Rakudo’s Binary Black Site

The Rakudo website is very “black belt energy” in appearance. I thought this was an interesting visual contrast.

In here, your butterflies are worthless vanities!

I tried running the binary releases linked from the Rakudo site, but this didn’t work out. I think I missed a very helpful line in the Readme.md file, yes it’s a weekend here, but also yes, binaries are usually easier to work with than this.

And then I remembered that binary releases probably aren’t really self-updating either. It seemed like I’d need to write a script to manage my binary installs, both in terms of integration and upgrading.

This cemented my interest in getting Rakubrew running.

Final Installation Wish

I would love to see some streamlining and friendliness-tweaks on the installer side.

Some of the most friendly installers I remember so far (ignoring the at-home-we-have-the-distro-version “apt-get” style methods!) have been:

Just food for thought though. It’s not completely fair to compare these with the Raku install, especially if we are very interested in emphasizing, for whatever reasons, that Raku is not Rakudo, and so on.

But it would be awesome to have one-click install access to the latest Raku distribution(s) from the Raku website.

Other notes of advice for those doing this

  • When issues come up using a third-party module (like GTK::Simple), check the example scripts included with the module, and compare.
    • You can learn some cool stuff this way, and this reminds me that I wish examples were easier to “have nearby” and integrate during the coding process. As-is, they are usually tucked in a repo.
    • Also, if you try ChatGPT thinking it’ll at least get you a nice conceptual framework to build from (it’s pretty good at this in general), it may not always reference the module correctly in the header of the script/application. But by god does it look right!
      • An easy fix if you check the actual examples or docs.
  • If you run your script and see a long list of errors / issues: Start at the top! Scroll back up and read the first few lines.
    • For example, with GTK::Simple, this was due to a missing GTK 3 development library, and I had to run sudo apt install libgtk-3-dev to get things to work.
    • This was easy to determine by reading from the top, and the tail end of the long output was nearly useless for my purposes.

All done!

This is what worked for me, and as always, what works for you might be slightly different.

My thanks to all who have contributed to the Raku language & community.

And, have fun coding in Raku!