The stand-alone version of MzScheme accepts a number of command-line flags.
MzScheme accepts the following flags:
Startup file and expression flags:
-eexpr or --evalexpr : Evaluates expr after MzScheme starts.
-ffile or --loadfile : Loads file after MzScheme starts.
-dfile or --load-cdfile : Uses load/cd to load file after MzScheme
-tfile or --requirefile : Requires file after MzScheme starts.
-F or --Load : Loads each
remaining argument as a file after MzScheme starts.
-D or --Load-cd : Loads each
remaining argument as a file using load/cd after MzScheme
-T or --Require : Requires each
remaining argument as a file after MzScheme starts.
-lfile or --mzlibfile: Requires the MzLib library file after MzScheme
-Lfilecollect : Requires the
library file in the collection collect after MzScheme
-Mcollect : Requires the library
collect.ss in the collection collect after
-rfile or --scriptfile : Use this flag for MzScheme-based scripts. It mutes the
startup banner printout, suppresses the read-eval-print loop, and loads
file after MzScheme starts. No argument after file is
treated as a flag. The -r or --script flag is a
shorthand for -fmv-.
-ifile or --script-cdfile : Same as -rfile or --scriptfile, except that the current directory is changed to
file's directory before it is loaded. The -i or
--script-cd flag is a shorthand for -dmv-.
--require-scriptfile : Same as -rfile or --scriptfile, except that file
is required instead of loaded. The -u or
--require-script flag is a shorthand for -tmv-.
-w or --awk : Loads the awk.ss
library after MzScheme starts.
-knm : Loads code embedded in
the executable from file position n to m after MzScheme
starts. This flag is useful for creating a stand-alone binary by
appending code to the normal MzScheme executable. See PLT mzc: MzScheme Compiler Manual
for more details.
-M or --main : Calls the
function bound to main in the top-level
environment, providing all leftover arguments (the ones installed in
current-command-line-arguments) to main as a
single list of immutable strings. The main function is
called only if no previous evaluations or loads resulted in an
-x or --no-lib-path : Suppresses
the initialization of current-library-collection-paths
(as described in Chapter 16).
-q or --no-init-file :
Suppresses loading the user's initialization file, as described
-A or --no-argv :
Suppresses the definition of argv and program, as described
Language setting flags:
-g or --case-sens : Creates an
initial namespace where identifiers and symbols are case-sensitive.
-s or --set-undef : Creates an
initial namespace where set! will successfully
mutate an undefined global variable (implicitly defining it).
-- : No argument following this flag is
used as a flag.
-m or --mute-banner : Suppresses
the startup banner text produced by -v.
-v or --version : Suppresses the
-h or --help : Shows information
about MzScheme's command-line flags and then exits, ignoring other
-p or --persistent : Catches the
SIGDANGER (low page space) signal and ignores it (AIX only).
-Rfile or --restorefile : Restores a saved image (see
section 14.8). Extra
arguments after file are returned as a vector of strings to
the continuation of the write-image-to-file call that
created the image.
Extra arguments following the last flag are available from the
current-command-line-arguments parameter (see
as an immutable vector of immutable strings. The name used to start
MzScheme is available from the find-system-path procedure
(see section 11.3.1)
using 'exec-file. In addition, unless -A is specified,
the argument vector is put into the global variable argv,
and the name used to start MzScheme is put into the global variable
program as an immutable string.
Multiple single-letter flags (the ones preceded by a single dash) can
be collapsed into a single flag by concatenating the letters, as long
as the the first flag is not --. The arguments for each flag
are placed after the collapsed flags (in the order of the
flags). For example,
-v -f file -m -e expr
are equivalent. If a collapsed -- appears before other collapsed
flags, it is implicitly moved to the end of the collapsed set.
so that the first actual command-line argument is the name of a file
to load into a namespace that will be initialized by the
dialect-specific init.ss library. The loaded file should
define main, which is called with the remaining arguments in a
The current-library-collection-paths parameter is
initialized (as described in
Chapter 16) before any expression or file is evaluated or
loaded, unless the -x or --no-lib-path flag is specified.
Unless the -q or --no-init-file flag is specified, a user
initialization file is loaded after
current-library-collection-paths parameter is initialized and
before any other expression or file is evaluated or loaded. The path
to the user initialization file is obtained from MzScheme's
find-system-path procedure using 'init-file.
Expressions and files are evaluated and loaded in order that they are
provided on the command line. If an error occurs, the remaining
expressions and files are skipped. The thread that loads the files
and evaluates the expressions is the main thread. When the
main thread terminates (or is killed), the MzScheme process
After the command-line files and expressions are loaded and evaluated,
the main thread calls read-eval-print-loop, unless the -v,
--version, -r, --script, -i, or
--script-cd flag is specified.
The exit status for the MzScheme process indicates an error if an error
occurs evaluating or loading a command-line expression or file and
read-eval-print-loop is not called afterwards, or if the default exit handler
is called with an exact integer between 1 and 255.