rakudo(1)

πŸ’… rakudo(1) β€” the manual page but make it a group chat

okay so bestie, this is rakudo, straight out of the Rakudo Manual. it's the manual page for the Raku compiler and it is lowkey a whole vibe. hydrate, sit down, we're doing this 🫢


✨ NAME ✨

raku β€” Rakudo Raku Compiler. that's the whole name. short, iconic, no notes. πŸ‘‘

🌸 SYNOPSIS 🌸

raku [switches] [--] [programfile] [arguments]

πŸ’– DESCRIPTION πŸ’–

here's the tea: run it with no arguments and it drops you into a REPL (yes, the interactive prompt, main character energy ✨). but if you hand it a [programfile] or you use the -e option, it compiles the program you gave it and, by default, also executes the compiled code. compile and execute, she does both, periodt. πŸ’…

and now, every single switch, no skips, all facts:

  • -c β€” check syntax only (and yes, it 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 module search path
  • -M module β€” loads the module prior 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 (only if enabled in MoarVM)
🚨 tiny but important: only boolean single-letter options may be bundled. don't get cute with it, iykyk.

the supported values for --target are giving:

  • parse β€” backend all β€” a representation of the parse tree
  • ast β€” backend all β€” an abstract syntax tree (before optimizations)
  • optimize β€” backend all β€” an abstract syntax tree (after optimizations)
  • mbc β€” backend MoarVM β€” MoarVM byte code
  • jar β€” backend JVM β€” JVM archive

and for --profile-filename: specifying a name ending in .json will write a raw JSON profile dump. if you omit it, the default is profile-[timestamp].html. πŸ“


🌈 ENVIRONMENT VARIABLES 🌈

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 PATH.

the underlying virtual machine is also sensitive to a series of environment variables; they are listed in this wiki page https://github.com/rakudo/rakudo/wiki/dev-env-vars#moarvm.

🧚 Module loading 🧚

  • RAKUDOLIB, RAKULIB (Str; src/core/Inc.pm) β€” these two 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.

πŸŽ€ Error message verbosity and strictness πŸŽ€

  • RAKU_EXCEPTIONS_HANDLER β€” 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 the Rakudo compiler as of version 2019.12, and before that it was available as PERL6_EXCEPTIONS_HANDLER.
  • RAKUDO_NO_DEPRECATIONS (Bool; src/core.c/Deprecations.pm6) β€” if true, it 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. no more soft launches bestie 😭
  • 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) β€” controls whether .setting files are included in backtraces.

✨ Affecting precompilation ✨

  • 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.
  • RAKUDO_PRECOMP_DIST, RAKUDO_PRECOMP_LOADING, RAKUDO_PRECOMP_WITH (src/core.c/CompUnit/PrecompilationRepository.pm6) β€” these are internal variables for passing serialized state to precompilation jobs in child processes. please do not set them manually. πŸ™ˆ
  • RAKUDO_LOG_PRECOMP β€” if set to 1, diagnostic information about the precompilation process is emitted.

πŸ’œ Line editor πŸ’œ

  • RAKUDO_LINE_EDITOR β€” specifies the preferred line editor to use; valid values are Readline, Linenoise, LineEditor, and none. a value of none is useful if you want to avoid the recommendation message upon REPL startup.
  • RAKUDO_DISABLE_MULTILINE β€” if set to 1, it disables multiline input for the REPL.
  • RAKUDO_HIST β€” 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 ~/.perl6/rakudo-history. if the older default file exists and the newer one does not, it will be automatically migrated. glow up ✨

πŸ¦‹ Other πŸ¦‹

  • RAKUDO_DEFAULT_READ_ELEMS β€” specifies the default number of characters to read on an LΒ«"IO::Handle"|/type/IO::HandleΒ» by setting the LΒ«"$*DEFAULT-READ-ELEMS"|/language/variables#$*DEFAULT-READ-ELEMSΒ» dynamic variable.
  • 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.
  • TMPDIR, TEMP, TMP (Str; src/core.c/IO/Spec/) β€” the 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 /tmp. IO::Spec::Cygwin and IO::Spec::Win32 use more Windows-appropriate lists which also include the %TEMP% and %TMP% environment variables.
  • PATH, Path (Str; src/core.c/IO/Spec/) β€” the 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::Unix. IO::Spec::Win32.path will read the first defined of either %PATH% or %Path% as a semicolon-delimited list.
  • RAKUDO_SNAPPER β€” indicates the period in which the telemetry snapper will take a snapshot. defaults to .1 for 10 snapshots per second.
  • RAKUDO_HOME β€” allows one 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.
  • NQP_HOME β€” allows one 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.

🌈 WINDOWS PECULIARITIES 🌈

Non-console applications

okay so on Windows, programs are compiled to either be console applications or non-console applications. console applications always open a console window, and there is no straightforward way to suppress this window. that's just the situation 😭

Rakudo provides a separate set of executables suffixed with a w (rakuw.exe, 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 STDOUT and STDERR. πŸ’€

to receive the output of the program it suffices to redirect it externally:

rakuw.exe script.raku >stdout.txt 2>stderr.txt

πŸ‘‘ AUTHORS πŸ‘‘

written by the Rakudo contributors, see the CREDITS file.

this manual page was written by Reini Urban, Moritz Lenz and the Rakudo contributors.

# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6

and that's the whole page, bestie! this one comes from the Raku manual, dated 2026-06-27, and it's page rakudo(1). go forth and compile something iconic πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from