2.4 Command-line options

The full set of command-line options is given below:

When given as the only option, it summarises the most important options. Also available as -h and -help.
When given as the only option, it summarises the version and the architecture identifier. Also available as -v.
When given as the only option, it prints the architecture identifier (see Prolog flag arch) and exits. See also -dump-runtime-variables. Also available as -arch.
When given as the only option, it prints a sequence of variable settings that can be used in shell-scripts to deal with Prolog parameters. This feature is also used by plld (see section 9.7). Below is a typical example of using this feature. Also available as -dump-runtime-variables.
eval `pl --dump-runtime-variables`
cc -I$PLBASE/include -L$PLBASE/runtime/$PLARCH ...

The option can be followed by =sh to dump in POSIX shell format (default) or cmd to dump in MS-Windows cmd.exe compatible format.

This option is available only in plwin.exe and is used for the start-menu item. If causes plwin to start in the folder ...\My Documents\Prolog or local equivalent thereof (see win_folder/2). The Prolog subdirectory is created if it does not exist.
Set the Prolog flag verbose to silent, suppressing informational and banner messages. Also available as -q.
Give local stack limit (default 16Mb on 32-bit and 32Mb on 64-bit hardware). Note that there is no space between the size option and its argument. By default, the argument is interpreted in Kbytes. Postfix the argument with m for Mbytes or g for Gbytes. The following example specifies 64 Mbytes local stack.
% pl -L64m

A maximum is useful to stop buggy programs from claiming all memory resources. -L0 sets the limit to the highest possible value.4On 64-bit systems there is no relevant limit and -L0 is interpreted as 1Gb. It is possible to ask for larger stack-sizes such as -L32g See section 2.18.

Give global stack limit (4 Mbytes default). See -L for more details.
Give trail stack limit (4 Mbytes default). This limit is relatively high because trail-stack overflows are not often caused by program bugs. See -L for more details.
Give argument stack limit (1 Mbytes default). The argument stack limits the maximum nesting of terms that can be compiled and executed. SWI-Prolog does `last-argument optimisation' to avoid many deeply nested structure using this stack. Enlarging this limit is only necessary in extreme cases. See -L for more details.
-c file ...
Compile files into an `intermediate code file'. See section 2.10.
-o output
Used in combination with -c or -b to determine output file for compilation.
Optimised compilation. See current_prolog_flag/2 flag optimise for details.
Disable debugging. See the current_prolog_flag/2 flag generate_debug_info for details.
-s file
Use file as a script-file. The script file is loaded after the initialisation file specified with the -f file option. Unlike -f file, using -s does not stop Prolog from loading the personal initialisation file.
-f file
Use file as initialisation file instead of the default .plrc (Unix) or pl.ini (Windows). `-f none' stops SWI-Prolog from searching for a startup file. This option can be used as an alternative to -s file that stops Prolog from loading the personal initialisation file. See also section 2.2.
-F script
Selects a startup-script from the SWI-Prolog home directory. The script-file is named <script>.rc. The default script name is deduced from the executable, taking the leading alphanumerical characters (letters, digits and underscore) from the program-name. -F none stops looking for a script. Intended for simple management of slightly different versions. One could for example write a script iso.rc and then select ISO compatibility mode using pl -F iso or make a link from iso-pl to pl.
-g goal
Goal is executed just before entering the top level. Default is a predicate which prints the welcome message. The welcome message can thus be suppressed by giving -g true. goal can be a complex term. In this case quotes are normally needed to protect it from being expanded by the shell. A save way to run a goal non-interactively is here:
% pl <options> -g go,halt -t 'halt(1)'
-t goal
Use goal as interactive top-level instead of the default goal prolog/0. goal can be a complex term. If the top-level goal succeeds SWI-Prolog exits with status 0. If it fails the exit status is 1. If the toplevel raises an exception, this is printed as an uncaught error and the toplevel is restarted. This flag also determines the goal started by break/0 and abort/0. If you want to stop the user from entering interactive mode start the application with `-g goal' and give `halt' as top-level.
Unix only. Switches controlling the terminal for allowing single-character commands to the tracer and get_single_char/1. By default manipulating the terminal is enabled unless the system detects it is not connected to a terminal or it is running as a GNU-Emacs inferior process. This flag is sometimes required for smooth interaction with other applications.
Inhibit any signal handling by Prolog, a property that is sometimes desirable for embedded applications. This option sets the flag signals to false. See section for details.
Use DIR as home directory. See section 9.8 for details.
-x bootfile
Boot from bootfile instead of the system's default boot file. A bootfile is a file resulting from a Prolog compilation using the -b or -c option or a program saved using qsave_program/[1,2].
-p alias=path1[:path2 ... ]
Define a path alias for file_search_path. alias is the name of the alias, path1 ... is a list of values for the alias. On Windows the list-separator is ;. On other systems it is :. A value is either a term of the form alias(value) or pathname. The computed aliases are added to file_search_path/2 using asserta/1, so they precede predefined values for the alias. See file_search_path/2 for details on using this file-location mechanism.
Stops scanning for more arguments, so you can pass arguments for your application after this one. See current_prolog_flag/2 using the flag argv for obtaining the command-line arguments.

The following options are for system maintenance. They are given for reference only.

-b initfile ...-c file ...
Boot compilation. initfile ... are compiled by the C-written bootstrap compiler, file ... by the normal Prolog compiler. System maintenance only.
-d level
Set debug level to level. Only has effect if the system is compiled with the -DO_DEBUG flag. System maintenance only.