How to run Rakudo, a Raku implementation, and modify its behavior with environment variables.
raku - Rakudo Raku Compiler
raku [switches] [--] [programfile] [arguments]
With no arguments, enters a REPL. With a
[programfile] or the
-e option, compiles the given program and by default also executes the compiled code.
-c check syntax only (runs BEGIN and CHECK blocks)--doc extract documentation and print it as text-e program one line of program, strict is enabled by default-h, --help display this help text-n run program once for each line of input-p same as -n, but also print at the end of lines-I path adds the path to the path-M the to running the program--target=[stage] specify compilation stage to emit--optimize=[level] use the given level of optimization (0..3)--encoding=[mode] specify string encoding mode-o, --output=[name] specify name of output file-v, --version display version information--stagestats display time spent in the compilation stages--ll-exception display a low level backtrace on errors--profile write profile information as HTML file (MoarVM)--profile-filename provide a different filename (also allows .json)--doc=[module] Use Pod::To::[module] to render inline documentation.--full-cleanup try to free all memory and exit cleanly (MoarVM)--debug-port=port listen for incoming debugger connections (MoarVM)--debug-suspend pause execution at the entry point (MoarVM)--tracing output a line to stderr on every interpreter instr (onlyif enabled in MoarVM)
Note that only boolean single-letter options may be bundled.
The supported values for
Target Backend Description====== ======= ===========parse all a representation of the parse treeast all an abstract syntax tree (before optimizations)optimize all an abstract syntax tree (after optimizations)mbc MoarVM MoarVM byte codejar JVM JVM archive
--profile-filename, specifying a name ending in
.json will write a raw JSON profile dump. The default if this is omitted is
Rakudo's behavior can be tweaked by a (growing) number of environment variables; this section attempts to document all those currently in use. They are interpreter specific in all cases, except where some use conventional names such as
The underlying virtual machine is also sensitive to a series of environment variables; they are listed in this wiki page.
RAKULIB (Str; src/core/Inc.pm)
RAKULIB append a comma-delimited list of paths to the search list for modules.
RAKUDOLIB is evaluated first. NOTE: These env vars were added in the Rakudo compiler in version 2020.05. The deprecated older env var
PERL6LIB is still available.
RAKUDO_MODULE_DEBUG (Bool; src/Perl6/ModuleLoader.nqp)
If true, causes the module loader to print debugging information to standard error.
If present, the
print_exception routine will use a class of that name to process the exception for output. Rakudo currently ships with
Exceptions::JSON (invoked by setting this variable to
JSON), to override the default output. NOTE: This env var was added in version 6.e. Early implementation has been available in Rakudo compiler as of version 2019.12, and before that it was available as
RAKUDO_NO_DEPRECATIONS (Bool; src/core.c/Deprecations.pm6)
If true, suppresses deprecation warnings triggered by the
is DEPRECATED trait.
RAKUDO_DEPRECATIONS_FATAL (Bool; src/core.c/Deprecations.pm6)
If true, deprecation warnings become thrown exceptions.
RAKUDO_VERBOSE_STACKFRAME (UInt; src/core.c/Backtrace.pm6)
Displays source code in stack frames surrounded by the specified number of lines of context; for instance
RAKUDO_VERBOSE_STACKFRAME = 1 will use one context line.
RAKUDO_BACKTRACE_SETTING (Bool; src/core.c/Backtrace.pm6)
.setting files are included in backtraces.
RAKUDO_PREFIX (Str; src/core.c/CompUnit/RepositoryRegistry.pm6)
When this is set, Rakudo will look for the standard repositories (perl, vendor, site) in the specified directory. This is intended as an escape hatch for build-time bootstrapping issues, where Rakudo may be built as an unprivileged user without write access to the runtime paths in NQP's config.
These are internal variables for passing serialized state to precompilation jobs in child processes. Please do not set them manually.
If set to 1, diagnostic information about the precompilation process is emitted.
This specifies the preferred line editor to use; valid values are
Linenoise, and none. A value of none is useful if you want to avoid the recommendation message upon REPL startup.
If set to 1, will disable multiline input for the REPL.
This specifies the location of the history file used by the line editor; the default is
~/.raku/rakudo-history. Before Rakudo version 2020.02 the default was
RAKUDO_ERROR_COLOR (Bool; src/core.c/Exception.pm6)
Controls whether to emit ANSI codes for error highlighting. Defaults to true if unset, except on Windows.
RAKUDO_MAX_THREADS (UInt; src/core.c/ThreadPoolScheduler.pm6)
Indicates the maximum number of threads used by default when creating a
ThreadPoolScheduler. Defaults to 64.
TMP (Str; src/core.c/IO/Spec/)
IO::Spec::Unix.tmpdir method will return
$TMPDIR if it points to a directory with full access permissions for the current user, with a fallback default of
IO::Spec::Win32 use more Windows-appropriate lists which also include the
%TMP% environment variables.
Path (Str; src/core.c/IO/Spec/)
IO::Spec::Unix.path method splits
$PATH as a shell would; i.e. as a colon-separated list.
IO::Spec::Cygwin inherits this from
IO::Spec::Win32.path will read the first defined of either
%Path% as a semicolon-delimited list.
Indicates the period in which the telemetry snapper will take a snapshot. Defaults to .1 for 10 snapshots per second.
Allows to override the Raku installation path. Defaults to
[rakudo_executable_dir]/../share/perl6 in relocatable builds and the absolute path to that folder in non-relocatable builds.
Allows to override the NQP installation path. Defaults to
[rakudo_executable_dir]/../share/nqp in relocatable builds and the absolute path to that folder in non-relocatable builds.
On Windows programs are compiled to either be console applications or non-console applications. Console applications always open a console window. There is no straightforward way to suppress this window.
Rakudo provides a separate set of executables suffixed with a
rakudow.exe, ...) that are compiled as non-console applications. These do not spawn this console window.
WARNING By default these non-console applications will silently swallow everything that is printed to
To receive the output of the program it suffices to redirect it externally:
rakuw.exe script.raku >stdout.txt 2>stderr.txt
Written by the Rakudo contributors, see the CREDITS file.
This manual page was written by Reini Urban, Moritz Lenz and the Rakudo contributors.