OS Manuals

/usr/bin/ocaml-4

The core OCaml 4 system: compilers, runtime system, base libraries

From ocaml-4 4.14.5-r0 (enterprise-packages), captured 2026-11-08 by running ocaml-4 --help (exit 0). permalink

Usage: ocaml <options> <files>
Options are:

  -absname  Show absolute filenames in error messages
  -alert <list>  Enable or disable alerts according to <list>:
        +<alertname>  enable alert <alertname>
        -<alertname>  disable alert <alertname>
        ++<alertname> treat <alertname> as fatal error
        --<alertname> treat <alertname> as non-fatal
        @<alertname>  enable <alertname> and treat it as fatal error
    <alertname> can be 'all' to refer to all alert names
  -I <dir>  Add <dir> to the list of include directories
  -init <file>  Load <file> instead of default init file
  -labels  Use commuting label mode
  -alias-deps  Do record dependencies for module aliases
  -no-alias-deps  Do not record dependencies for module aliases
  -app-funct  Activate applicative functors
  -no-app-funct  Deactivate applicative functors
  -noassert  Do not compile assertion checks
  -noinit  Do not load any init file
  -nolabels  Ignore non-optional labels in types
  -noprompt  Suppress all prompts
  -nopromptcont  Suppress prompts for continuation lines of multi-line inputs
  -nostdlib  Do not add default directory to the list of include directories
  -nopervasives  (undocumented)
  -open <module>  Opens the module <module> before typing
  -ppx <command>  Pipe abstract syntax trees through preprocessor <command>
  -principal  Check principality of type inference
  -no-principal  Do not check principality of type inference (default)
  -rectypes  Allow arbitrary recursive types
  -no-rectypes  Do not allow arbitrary recursive types (default)
  -safe-string  (was set when configuring the compiler)
  -short-paths  Shorten paths in types
  -stdin  Read script from standard input
  -strict-sequence  Left-hand part of a sequence must have type unit
  -no-strict-sequence  Left-hand part of a sequence need not have type unit (default)
  -strict-formats  Reject invalid formats accepted by legacy implementations
     (Warning: Invalid formats may behave differently from
      previous OCaml versions, and will become always-rejected
      in future OCaml versions. You should always use this flag
      to detect invalid formats so you can fix them.)
  -no-strict-formats  Accept invalid formats accepted by legacy implementations (default)
     (Warning: Invalid formats may behave differently from
      previous OCaml versions, and will become always-rejected
      in future OCaml versions. You should never use this flag
      and instead fix invalid formats.)
  -unboxed-types  unannotated unboxable types will be unboxed
  -no-unboxed-types  unannotated unboxable types will not be unboxed (default)
  -unsafe  Do not compile bounds checking on array and string access
  -unsafe-string  (option not available)
  -version  Print version and exit
  --version  Print version and exit
  -no-version  Do not print version at startup
  -vnum  Print version number and exit
  -w <list>  Enable or disable warnings according to <list>:
        +<spec>   enable warnings in <spec>
        -<spec>   disable warnings in <spec>
        @<spec>   enable warnings in <spec> and treat them as errors
     <spec> can be:
        <num>             a single warning number
        <num1>..<num2>    a range of consecutive warning numbers
        <letter>          a predefined set
     default setting is "+a-4-7-9-27-29-30-32..42-44-45-48-50-60-66..70"
  -warn-error <list>  Enable or disable error status for warnings according
     to <list>.  See option -w for the syntax of <list>.
     Default setting is "-a+31"
  -warn-help  Show description of warning numbers
  - <file>  Treat <file> as a file name (even if it starts with `-')
  -color {auto|always|never}  Enable or disable colors in compiler messages
    The following settings are supported:
      auto    use heuristics to enable colors only if supported
      always  enable colors
      never   disable colors
    The default setting is 'auto', and the current heuristic
    checks that the TERM environment variable exists and is
    not empty or "dumb", and that isatty(stderr) holds.
  If the option is not specified, these setting can alternatively
  be set through the OCAML_COLOR environment variable.
  -error-style {contextual|short}  Control the way error messages and warnings are printed
    The following settings are supported:
      short       only print the error and its location
      contextual  like "short", but also display the source code
                  snippet corresponding to the location of the error
    The default setting is 'contextual'.
  If the option is not specified, these setting can alternatively
  be set through the OCAML_ERROR_STYLE environment variable.
  -dno-unique-ids  (undocumented)
  -dunique-ids  (undocumented)
  -dno-locations  (undocumented)
  -dlocations  (undocumented)
  -dsource  (undocumented)
  -dparsetree  (undocumented)
  -dtypedtree  (undocumented)
  -dshape  (undocumented)
  -drawlambda  (undocumented)
  -dlambda  (undocumented)
  -dinstr  (undocumented)
  -args <file> Read additional newline-terminated command line arguments
      from <file>
  -args0 <file> Read additional null character terminated command line arguments
from <file>
  -e <script>  Evaluate given script
  -help  Display this list of options
  --help  Display this list of options
Options (56)
OptionDescriptionSource
-absnameShow absolute filenames in error messages.help + man
-alert listEnable or disable alerts according to <list>: +<alertname> enable alert <alertname>help
-I dirAdd <dir> to the list of include directorieshelp
-init fileLoad <file> instead of default init filehelp
-labelsLabels are not ignored in types, labels may be used in applications, and labelled parameters can be given in any order.help + man
-alias-depsDo record dependencies for module aliaseshelp
-no-alias-depsDo not record dependencies for module aliaseshelp
-app-functActivate applicative functorshelp
-no-app-functDeactivates the applicative behaviour of functors.help + man
-noassertDo not compile assertion checks.help + man
-noinitDo not load any initialization file.help + man
-nolabelsIgnore non-optional labels in types.help + man
-nopromptDo not display any prompt when waiting for input.help + man
-nopromptcontDo not display the secondary prompt when waiting for continuation lines in multi-line inputs.help + man
-nostdlibDo not include the standard library directory in the list of directories searched for source and compiled files.help + man
-nopervasives(undocumented)help
-open moduleOpens the module <module> before typinghelp
-ppx commandPipe abstract syntax trees through preprocessor <command>help
-principalCheck information path during type-checking, to make sure that all types are derived in a principal way.help + man
-no-principalDo not check principality of type inference (default)help
-rectypesAllow arbitrary recursive types during type-checking.help + man
-no-rectypesDo not allow arbitrary recursive types (default)help
-safe-stringEnforce the separation between types string and bytes, thereby making strings read-only.help + man
-short-pathsWhen a type is visible under several module-paths, use the shortest one when printing the type's name in inferred interfaces and error and warning messages.help + man
-stdinRead the standard input as a script file rather than starting an interactive session.help + man
-strict-sequenceForce the left-hand part of each sequence to have type unit.help + man
-no-strict-sequenceLeft-hand part of a sequence need not have type unit (default)help
-strict-formatsReject invalid formats accepted by legacy implementations (Warning: Invalid formats may behave differently from previous OCaml versions, and will become always-rejected in future OCaml versions.help
-no-strict-formatsAccept invalid formats accepted by legacy implementations (default) (Warning: Invalid formats may behave differently from previous OCaml versions, and will become always-rejected in future OCaml…help
-unboxed-typesWhen a type is unboxable (i.e. a record with a single argument or a concrete datatype with a single constructor of one argument) it will be unboxed unless annotated with [@@ocaml.boxed].help + man
-no-unboxed-typesWhen a type is unboxable it will be boxed unless annotated with [@@ocaml.unboxed].help + man
-unsafeTurn bound checking off on array and string accesses (the v.(i)ands.[i] constructs).help + man
-unsafe-stringIdentify the types string and bytes, thereby making strings writable.help + man
-versionPrint version string and exit.help + man
--versionPrint version and exithelp
-no-versionDo not print the version banner at startup.help + man
-vnumPrint short version number and exit.help + man
-w listEnable or disable warnings according to <list>: +<spec> enable warnings in <spec>help
-warn-error listEnable or disable error status for warnings according to <list>.help
-warn-helpShow the description of all available warning numbers.help + man
-color auto|always|neverEnable or disable colors in compiler messages The following settings are supported: auto use heuristics to enable colors only if supported always enable colors never disable colors The default…help
-error-style contextual|shortControl the way error messages and warnings are printed The following settings are supported: short only print the error and its location contextual like "short", but also display the source code…help
-dno-unique-ids(undocumented)help
-dunique-ids(undocumented)help
-dno-locations(undocumented)help
-dlocations(undocumented)help
-dsource(undocumented)help
-dparsetree(undocumented)help
-dtypedtree(undocumented)help
-dshape(undocumented)help
-drawlambda(undocumented)help
-dlambda(undocumented)help
-dinstr(undocumented)help
-e scriptEvaluate given scripthelp
-helpDisplay this list of optionshelp
--helpDisplay this list of optionshelp

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.