Command-Line Arguments of KLayout

KLayout's command line basically looks like this:

klayout [<options>] [<file>] ..

Options start with a hyphen ("-") and can be mixed with file names. Files given on the command line without an option are treated as layout files (GDS, OASIS, ...). Each option must be specified separately, i.e. "-ne" is not option "n" and "e". Option arguments must be separated by a space from the option itself. For example:

klayout -s file1.gds file2.gds -l layers.lyp

This command will open "file1.gds" and "file2.gds" in the same view (option "-s") and use the layer properties file "layers.lyp".

The following is a description of KLayout's command-line options.

General Options

-c <config file> Use the specified configuration file (reading it on start and writing it on exit) instead of the default configuration file. This option allows to switch between different configurations.
-d <debug level> Controls the verbosity of the log output. Values are: 0 (silent), 10 (basic info), 11 (basic info plus basic timing), 20 (detailed info), 21 (detailed info plus detailed timing) to 40 or 41 for noisy log output and timing respectively.
-e Enter edit mode even if non-edit mode was specified in the configuration as default mode.
-ne Enter viewer mode even if edit mode was specified in the configuration as default mode. If neither -e or -ne is specified, the default mode from the configuration will be used.
-i Disable undo buffering (less memory requirements).
-ni Enable undo buffering. This is the default. This option overrides previously set "-i" options.
-l <lyp file> Use the specified layer properties file instead of the default layer properties.
-lx Used with "-l": add other layers to the layer properties even if they are not defined in the properties file.
-lf Used with "-l": use the lyp file as it is (no expansion to multiple layouts).
-m <database file> Load the given report database together with the previously defined layout. This option must follow a layout file argument.
-p <plugin> Load the plugin (a shared object). This option can be used multiple times.
-r <script> Run the given Ruby script in interpreter mode. In that mode, KLayout will exit after the script is executed. To start KLayout, the script must contain a "Application.exec" method call. The script is executed after all other requisites from the command line have been loaded (files, plugins etc.)
This option can be combined with "-z" (no GUI). That way, KLayout is converted into a ruby interpreter.
-rm <script> Run the given Ruby script before KLayout starts the user interface. In contrast to "-r", KLayout continues normal execution after the script is executed successfully. This is the preferred way to install user interface add-ons ("Modules"). In addition to the modules specified by "-rm", KLayout collects files with extension ".rbm" from various places, i.e. the place specified with $KLAYOUTPATH on Unix or the installation folder on Windows.
-rd <name>=<value> Define the variable in the Ruby context with the given string value. The variable will be accessible as "$name".
-s Load files into same view.
-t Don't update the configuration file on exit (amnesia mode).
-u <file name> Restore the session from the given session file.
-v Print program version and exit.
-x Synchronous drawing mode (non-threaded). This mode can be useful if scripts are run which produce screen snapshots. By using this option is made sure that all drawing operations have finished before the snapshot method returns.
-z Non-GUI mode. KLayout will not bring up the user interface. See the "-r" option for useful applications of this option.

Special Options

-gr <file name> Record GUI actions in the given file for test purposes.
-gp <file name> Replay the GUI actions from the given file for test purposes.
-gb <line number> Stop replaying GUI actions at the given line for test purposes.
-gx <milliseconds> Replay rate for GUI test file for test purposes.
-gi Incremental logs on the GUI record file (crash safe logging).
-rx Ignore global "rbainit" and ".rbm" files. Used to establish a defined basis for tests.