Skip to content

Instantly share code, notes, and snippets.

@mikeraynham
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeraynham/8c9a4a211a4d5cf6190c to your computer and use it in GitHub Desktop.
Save mikeraynham/8c9a4a211a4d5cf6190c to your computer and use it in GitHub Desktop.
How to get Rakudo Perl 6

Definitions

Some grossly over-simplified definitions:

  • Perl 6 is a language specification.
  • Rakudo is a compiler for Perl 6.
  • Rakudo Star (or Rakudo *) is a distribution that contains the Rakudo compiler, documentation and some useful modules.
  • MoarVM and JVM are Process Virtual Machines. They provide an interface between the compiler and the underlying operating system or machine. If you don't know which to choose, try MoarVM first. You can always switch to the JVM if MoarVM doesn't suit your needs.

Installing Rakudo Star

If you just want to install and use Perl 6 with some documentation and a selection of useful modules, then this section is for you. If you are a developer looking to hack on the compiler internals then please see Installing Rakudo, below.

Windows

Windows Installer packages are available as MSI files here:

http://rakudo.org/downloads/star/

As of the 2015.02 version, the MSI installs Rakudo Star with MoarVM under C:\rakudo. The executable files can be found under C:\rakudo\bin\, and a shortcut will be placed under your menu.

OS X

Rakudo Star is available from Homebrew. If you want to check the version before installing:

brew info rakudo-star

To install:

brew install rakudo-star

Linux & Unix-like operating systems

Your distribution's package manager is often the easiest way to install applications, and Rakudo Star is available as a package for some distributions. With that said, Rakudo is still under very active development, so many packages will be out-of-date very quickly. It is highly recommended that you install from source. If you really want to install from a package, check your package manager for rakudo or rakudo-star packages. Otherwise, please see the Building from source section, below.

Building from source

The simplest way to install from source on Unix-like operating systems is to use rakudobrew. See the rakudobrew section, below, for more information. If rakudobrew is not flexible enough for you, see the Manual installation section, below, for more information.

Prerequisites

To install Rakudo Star from source you'll need Perl 5.8 or newer, git, make and gcc. We can't provide in-depth details for how to install these, but many distributions provide package groups that install common build tools. Here are examples for some popular Linux distributions:

Debian / Ubuntu
apt-get install build-essential git
Red Hat / CentOS / Fedora
yum install git
yum groupinstall 'Development Tools'

On CentOS 7 (and perhaps other versions too), Perl 5 autodie must be installed too:

yum install perl-autodie

rakudobrew

rakudobrew is a tiny script that aims to make installing Rakudo from source a little bit easier. Don't expect all the features of Perlbrew. The following commands install rakudobrew, Rakudo and Panda.

To install rakudobrew on Linux:

git clone https://github.com/tadzik/rakudobrew ~/.rakudobrew
echo 'export PATH=~/.rakudobrew/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

To install rakudobrew on OS X:

git clone https://github.com/tadzik/rakudobrew ~/.rakudobrew
echo 'export PATH=~/.rakudobrew/bin:$PATH' >> ~/.bash_profile
source ~/.bash_profile

To install Rakudo and Panda using rakudobrew:

rakudobrew build moar
rakudobrew build-panda

Finally, install Task::Star. This will install all the modules that are shipped with the Rakudo Star Perl 6 distribution:

panda install Task::Star

Manual installation

If rakudobrew is not flexible enough for you, you might want to consider manually installing from source. The exact steps required may differ depending on your operating system, but these instructions should be enough to get you started. This example uses Rakudo Star 2015.02, but development is progressing quickly, so please be sure to check for the latest version. You should consult the README file contained in the tarball for more up-to-date and detailed information.

mkdir ~/rakudo && cd $_
curl -O http://rakudo.org/downloads/star/rakudo-star-2015.02.tar.gz
tar -xvzf rakudo-star-2015.02.tar.gz
cd rakudo-star-2015.02/

perl Configure.pl --backend=moar --gen-moar
make

# Running the tests is optional, but advised:
make rakudo-test
make rakudo-spectest

make install

echo "export PATH=$(pwd)/install/bin/:\$PATH" >> ~/.bashrc
source ~/.bashrc

Installing Rakudo

If you are a developer looking to hack on the compiler internals, then this is the section for you. Rakudo is the compiler, and it does not contain the documentation or modules found in Rakudo Star. If you just want to install and use Perl 6 with some documentation and a selection of useful modules, then please see Installing Rakudo Star, above.

Prerequisites

To install Rakudo from source you'll need Perl 5.8 or newer, git, make and gcc.

Manual installation

Since Rakudo is under rapid development, potential developers should download Rakudo directly from GitHub and build from there:

git clone git://github.com/rakudo/rakudo.git

To install Rakudo to run on MoarVM:

cd rakudo
perl Configure.pl --gen-moar --gen-nqp --backends=moar
make
make install

For more detailed and up-to-date information, please refer to the README.md file. This contains information about additional configuration options, including installing for use on the JVM, and with multiple backends.

Using Rakudo

To run a Perl 6 program with Rakudo, include the install directory in your system PATH variable and issue a command like:

perl6 hello.pl

If the Rakudo compiler is invoked without an explicit script to run, it enters a small interactive mode that allows Perl 6 statements to be executed from the command line. Each line entered is treated as a separate compilation unit, which means that subroutines are preserved after they are defined, but variables are not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment