---
id: cli-ref
title: Command Line Reference
sidebar_label: CLI Reference
---

<!-- DO NOT EDIT. This file is autogenerated.    -->
<!--                                             -->
<!-- To update the help output, run              -->
<!--                                             -->
<!--     bazel run //website:update_cli_ref      -->
<!--                                             -->
<!-- To update the preamble or formatting, edit  -->
<!--                                             -->
<!--     website/scripts/generate_cli_ref.sh     -->
<!--                                             -->
<!-- and then run the above command.             -->

This page shows the `srb tc --help` output for the latest version of Sorbet.

- See [Command Line Quickstart](cli.md) for an overview of some of the more common options and workflows.

- See `srb tc --help` to see the help options for your version of Sorbet. (New options are added and changed all the time.)

## Usage

```plaintext
Sorbet: A fast, powerful typechecker designed for Ruby
Usage:
  sorbet [options] [[--] <path>...]

```

## INPUT options

```plaintext
  -e <string>                   Treat <string> as if it were the contents of a Ruby file
                                passed on the command line (default: "")
      --e-rbi <string>          Like `-e`, but treat <string> as an RBI file (default:
                                "")
      --file <path>             Run over the contents of <path>
                                (Equivalent to passing <path> as a positional argument)
      --dir <path>              Run over all Ruby and RBI files in <path>, recursively
                                (Equivalent to passing <path> as a positional argument)
      --allowed-extension <ext>[,<ext>...]
                                Use these extensions to determine which file types Sorbet
                                should discover inside directories. (default: .rb,.rbi)
      --ignore <pattern>        Ignores input files that contain <pattern> in their paths
                                (relative to the input path passed to Sorbet).
                                When <pattern> starts with `/` it matches against the
                                prefix of these relative paths; others match anywhere.
                                Matches must be against whole path segments, so `foo`
                                matches `foo/bar.rb` and `bar/foo/baz.rb` but not
                                `foo.rb` or `foo2/bar.rb`.
      --no-config               Do not load the content of the `sorbet/config` file.
                                Otherwise, Sorbet reads the `sorbet/config` file and
                                treats each line as if it were passed on the command
                                line, unless the line starts with `#`.
                                To load a <file> as if it were a config file, pass
                                `@<file>` as a positional arg
      --typed {false,true,strict,strong,[auto]}
                                Force all code to specified strictness level,
                                disregarding all `# typed:` sigils. For `auto`, uses the
                                `# typed:` sigil in the file or `false` for files without
                                a sigil. (default: auto)
      --typed-override <filepath.yaml>
                                Read <filepath.yaml> to override the strictness of
                                individual files.
                                Contents must be a map of `<strictness>: ['path1.rb',
                                ...]` pairs.
                                Can be used to enable type checking for certain files
                                temporarily without having to add a comment to every
                                file. (default: "")

```

## OUTPUT options

```plaintext
  -q, --quiet                   Silence all non-critical errors
  -P, --progress                Draw progressbar
      --color {always,never,[auto]}
                                Use color output. For `auto`: use color if stderr is a
                                tty (default: auto)
      --no-error-count          Do not print the `Errors: <N>` summary line
      --no-error-sections       Only print the first line of every error message
                                (suppress any additional information below an error). Can
                                provide substantial speedups when dealing with many
                                errors
      --error-url-base <url-base>
                                Every error message includes a link created by prefixing
                                that error's code with <url-base>. Can be used to
                                maintain docs on Sorbet error codes which are more
                                relevant to a specific project or company. (default:
                                https://srb.help/)
      --remove-path-prefix <prefix>
                                Remove the provided <prefix> from all printed paths.
                                Defaults to the input directory passed to Sorbet, if any.
                                (default: "")
      --gen-packages [={normal,strict}(=normal)]
                                Generate package information (normal or strict)

```

## AUTOCORRECT options

```plaintext
  -a, --autocorrect             Auto-correct source files with suggested fixes.
                                Use the `--{isolate,suppress}-error-code` options to
                                control which corrections to apply
      --suggest-unsafe [=<method>(=T.unsafe)]
                                Include 'unsafe' autocorrects, e.g. those which can be
                                fixed by wrapping code in `T.unsafe` or using
                                `T.untyped`. Provide a custom <method> to wrap with
                                `<method>(...)` instead of `T.unsafe(...)`. This
                                supersedes certain autocorrects, especially T.must.
      --did-you-mean            Whether to include 'Did you mean' suggestions in
                                autocorrects. For large codemods, it's usually better to
                                avoid spurious changes by setting this to false (default:
                                true)
      --suggest-typed           Emit autocorrects to set the `# typed:` sigil in every
                                file to the highest possible level where no errors would
                                be reported in that file. Will downgrade the `# typed:`
                                sigil for any files with errors.

```

## ERROR options

```plaintext
      --typed-super             Enable typechecking of `super` calls when possible
                                (default: true)
      --check-out-of-order-constant-references
                                Detect when a constant is referenced early in a file, but
                                defined later in that file. Does not detect out-of-order
                                references across file boundaries.
      --isolate-error-code <error-code>
                                Which error(s) to include in reporting. This option can
                                be passed multiple times. All errors not mentioned will
                                be silenced.
      --suppress-error-code <error-code>
                                Which error(s) to exclude from reporting. This option can
                                be passed multiple times.
      --suppress-payload-superclass-redefinition-for Fully::Qualified::ClassName
                                Explicitly suppress the superclass redefinition error for
                                the specified class defined in Sorbet's payload. May be
                                repeated.
      --experimental-ruby3-keyword-args
                                Enforce use of new (Ruby 3.0-style) keyword arguments.
                                (incomplete and experimental)
      --uniquely-defined-behavior
                                Ensure that every class and module only defines
                                'behavior' in one file. Ensures that every class or
                                module can be autoloaded by loading exactly one file.
      --stop-after <phase>      Stop after completing <phase>. Can be useful for
                                debugging. Also useful when overwhelmed with errors,
                                because errors from earlier phases (like resolver) can
                                cause errors downstream (in inferencer).
                                Phases: [init, parser, rbs, desugarer, rewriter,
                                local-vars, namer, resolver, cfg, inferencer] (default:
                                inferencer)

```

## METRIC options

```plaintext
      --counters                Print all internal counters
      --counter <counter>       Print internal counter for <counter> (repeatable)
      --track-untyped [={[nowhere],everywhere,everywhere-but-tests}(=everywhere)]
                                Include a per-file counter of untyped usages in the
                                `--print=file-table-json` output. This is in addition to
                                the codebase-wide `types.input.untyped.usages` counter.
      --metrics-file <file>     Report counters and some timers to <file>, in JSON
                                format. (default: "")
      --metrics-prefix <string>
                                String to prefix all metrics with, e.g. `my_org.my_repo`.
                                (default: ruby_typer.unknown)
      --metrics-branch <branch>
                                Branch to report in metrics export. (default: none)
      --metrics-sha <sha>       Set the `sha` field to <sha> in the `--metrics-file`
                                output. (default: none)
      --metrics-repo <repo>     Set the `repo` field to <repo> in the `--metrics-file`
                                output. (default: none)
      --statsd-host <host>      StatsD sever hostname (default: "")
      --statsd-prefix <prefix>  StatsD prefix (default: ruby_typer.unknown)
      --statsd-port <port>      StatsD server port (default: 8200)
      --statsd-tag-revision     Tags some metrics with the revision Sorbet was built from
                                (default: true)
      --metrics-extra-tags <key1>=<value1>,<key2>=<value2>
                                Extra tags to include in every statsd metric, comma
                                separated. (default: "")

```

## LSP options

```plaintext
      --lsp                     Start in language server protocol mode (LSP mode)
      --lsp-error-cap <cap>     Reports no more than <cap> diagnostics (e.g. errors and
                                informations) to the language client, like VS Code. Can
                                prevent slowdown triggered by large diagnostic lists. A
                                <cap> of 0 means no limit. (default: 1000)
      --disable-watchman        When in LSP mode, disable file watching via Watchman
      --watchman-path <path>    Path to watchman executable. Will search on `PATH` if
                                <path> contains no slashes. (default: watchman)
      --watchman-pause-state-name <state>
                                Name of watchman state that halts processing for its
                                duration (default: "")
      --watchman-namespace <namespace>
                                Namespace for watchman (default: "")
      --lsp-directories-missing-from-client <path>
                                Directory prefixes that only exist where the LSP server
                                is running, not on the client. Useful when running Sorbet
                                via an `ssh` connection to a remote server, where the
                                remote server has generated files that do not exist on
                                the client. References to files in these directories will
                                be sent as `sorbet:` URIs to clients that understand
                                them.
      --forcibly-silence-lsp-multiple-dir-error
                                Allow the LSP to start with multiple `--dir` options by
                                silencing the error. (WARNING: This flag does not address
                                the known issues with multiple directory support in LSP
                                mode. You are likely to encounter unexpected behavior.)

```

## LSP FEATURE options

```plaintext
      --enable-experimental-lsp-document-highlight
                                Enable experimental LSP feature: Document Highlight
      --enable-experimental-lsp-signature-help
                                Enable experimental LSP feature: Signature Help
      --enable-experimental-lsp-extract-to-variable
                                Enable experimental LSP feature: Extract To Variable
      --enable-experimental-lsp-create-missing-method
                                Enable experimental LSP feature: Create Missing Method
      --enable-all-experimental-lsp-features
                                Enable every experimental LSP feature. (WARNING: can be
                                crashy; for developer use only. End users should prefer
                                to use `--enable-all-beta-lsp-features`, instead.)
      --enable-all-beta-lsp-features
                                Enable (expected-to-be-non-crashy) early-access LSP
                                features.

```

## PERFORMANCE options

```plaintext
      --web-trace-file <file>   Generate a trace into <file> in the Trace Event Format
                                (used by chrome://tracing) (default: "")
      --web-trace-file-strict   Whether to close the toplevel array in `--web-trace-file`
      --cache-dir <dir>         Use <dir> to cache certain data. Will create <dir> if it
                                does not exist (default: "")
      --max-cache-size-bytes <bytes>
                                Must be a multiple of OS page size (usually 4096).
                                Subject to restrictions on mdb_env_set_mapsize function
                                in LMDB API docs. (default: 4294967296)
      --max-threads <n>         Set number of threads to use for fork/join worker pools.
                                LSP will <n> threads plus some extra threads to manage
                                the connection with the client, watchman, etc. (default:
                                number of cores on the system)
      --reserve-class-table-capacity <n>
                                Preallocate <n> slots in the class and modules table
                                (default: 0)
      --reserve-method-table-capacity <n>
                                Preallocate <n> slots in the method table (default: 0)
      --reserve-field-table-capacity <n>
                                Preallocate <n> slots in the field table (default: 0)
      --reserve-type-argument-table-capacity <n>
                                Preallocate <n> slots in the type argument table
                                (default: 0)
      --reserve-type-member-table-capacity <n>
                                Preallocate <n> slots in the type member table (default:
                                0)
      --reserve-utf8-name-table-capacity <n>
                                Preallocate <n> slots in the UTF8 name table (default: 0)
      --reserve-constant-name-table-capacity <n>
                                Preallocate <n> slots in the constant name table
                                (default: 0)
      --reserve-unique-name-table-capacity <n>
                                Preallocate <n> slots in the unique name table (default:
                                0)

```

## SORBET PACKAGES MODE options

```plaintext
      --stripe-packages         Enable support for Sorbet's experimental Ruby package
                                system
      --stripe-packages-hint-message arg
                                Optional hint message to add to all packaging related
                                errors (default: "")
      --sorbet-packages         Enable support for Sorbet's experimental Ruby package
                                system
      --sorbet-packages-hint-message arg
                                Optional hint message to add to all packaging related
                                errors (default: "")
      --extra-package-files-directory-prefix-underscore <dir>
                                Extra parent directories which contain package files.
                                Files are associated to a package using a package's
                                namespace joined by underscores. That is, files in
                                <dir>/Project_FooBar/ belong to Project::FooBar
      --extra-package-files-directory-prefix-slash-deprecated <dir>
                                Extra parent directories which contain package files.
                                Files are associated to a package using slash munging
                                conventions. That is, files in <dir>/Project/Foo_bar/
                                belong to Project::FooBar. This is deprecated in favor of
                                --extra-package-files-directory-prefix-slash since the
                                paths are more readable
      --extra-package-files-directory-prefix-slash <dir>
                                Extra parent directories which contain package files.
                                Files are associated to a package using a package's
                                namespace join by slashes. That is, files in
                                <dir>/Project/FooBar/ belong to Project::FooBar
      --allow-relaxed-packager-checks-for <name>
                                Packages which are allowed to ignore the restrictions set
                                by `visible_to` and `export` directives
      --gen-packages-update-visibility-for <name>
                                Packages for which to generate `visible_to` autocorrects
                                in --gen-packages mode
      --gen-packages-allow-relaxing-test-visibility
                                Allow adding `visible_to 'tests'` for packages with
                                visibility updates
      --packager-layers [=<layer-name>(=library,application)]
                                Valid layer names for packages, ordered lowest to
                                highest. Passing this flag also enables layering checks.
      --package-skip-rbi-export-enforcement <dir>
                                Constants defined in RBIs in these directories (and no
                                others) can be exported
      --package-attributed-errors
                                Attribute errors to their enclosing package in the error
                                output
      --experimental-package-directed
                                Enable support for checking by package, instead of
                                processing all files at once
      --experimental-test-packages
                                Enable support for tests as their own packages

```

## STRIPE AUTOGEN options

```plaintext
      --autogen-version arg     Autogen version to output
      --autogen-subclasses-parent string
                                Parent classes for which generate a list of subclasses.
                                This option must be used in conjunction with -p
                                autogen-subclasses
      --autogen-subclasses-ignore string
                                Like --ignore, but it only affects `-p
                                autogen-subclasses`.
      --autogen-behavior-allowed-in-rbi-files-paths string
                                RBI files defined in these paths can be considered by
                                autogen as behavior-defining.
      --autogen-msgpack-skip-reference-metadata
                                Skip serializing extra metadata on references when
                                printing msgpack in autogen

```

## DEBUGGING options

```plaintext
  -v, --verbose                 Verbosity level [0-3]
      --debug-log-file <file>   Path to debug log file (default: "")
      --wait-for-dbg            Wait for debugger to attach after starting. Especially
                                useful to attach to a Sorbet process launched by a
                                language client
      --sleep-in-slow-path [=arg(=3)]
                                Add some sleeps to slow path to artificially slow it down
      --stress-incremental-resolver
                                Simulate updates which tend to expose namer and resolver
                                bugs
      --simulate-crash          Raise an uncaught C++ exception on startup to simulate a
                                crash
      --force-hashing           Force Sorbet to calculate file hashes, even from the CLI.
                                Useful for profiling.
      --trace-lexer             Emit the lexer's token stream in a debug format
      --trace-parser            Enable bison's parser trace functionality
  -p, --print <format>          Print various internal data structures.
                                By default, the output is to stdout. To send the data to
                                a file, use
                                --print=<format>:<file>
                                Most of these formats are unstable, for internal-use only.

                                Stable: [file-table-json, file-table-full-json,
                                missing-constants, payload-sources, untyped-blame]

                                Unstable: [parse-tree, parse-tree-json,
                                parse-tree-json-with-locs, parse-tree-whitequark,
                                rbs-rewrite-tree, desugar-tree, desugar-tree-raw,
                                desugar-tree-raw-with-locs, rewrite-tree,
                                rewrite-tree-raw, index-tree, index-tree-raw, name-tree,
                                name-tree-raw, resolve-tree, resolve-tree-raw,
                                flatten-tree, flatten-tree-raw, ast, ast-raw, cfg,
                                cfg-raw, cfg-text, symbol-table, symbol-table-raw,
                                symbol-table-json, symbol-table-full,
                                symbol-table-full-raw, symbol-table-full-json, autogen,
                                autogen-msgpack, autogen-subclasses, package-tree,
                                minimized-rbi

```

## INTERNAL options

```plaintext
      --suppress-non-critical   Exit 0 unless there was a critical error (i.e., an
                                uncaught exception)
      --no-stdlib               Do not load Sorbet's payload which defines RBI files for
                                the Ruby standard library
      --store-state file        Store state into three files, separated by commas:
                                <symbol-table>,<name-table>,<file-table> (default: "")
      --silence-dev-message     Silence "You are running a development build" message
      --censor-for-snapshot-tests
                                When printing raw location information, don't show line
                                numbers

```

## EXPERIMENTAL options

```plaintext
      --enable-experimental-requires-ancestor
                                Enable experimental `requires_ancestor` annotation
      --enable-experimental-rbs-signatures
                                Enable experimental support for RBS signatures as inline
                                comments
      --enable-experimental-rbs-assertions
                                Enable experimental support for RBS assertions as inline
                                comments
      --enable-experimental-rbs-comments
                                Enable experimental support for RBS signatures and
                                assertions as inline comments
      --enable-experimental-rspec
                                Enables experimental support for RSpec. There are many
                                RSpec constructs that are impossible for Sorbet to
                                handle. As a result, there is no path to this flag ever
                                being stable: RSpec support is best effort.
      --enable-experimental-method-modifiers
                                Enable experimental support for method def modifiers like
                                `abstract def foo; end`.
                                Implicitly enabled if you enable RBS support.

```

## OTHER options

```plaintext
      --version                 Show Sorbet's version
      --license                 Show Sorbet's license, and licenses of its dependencies
      --stdout-hup-hack         Monitor STDERR for HUP and exit on hangup to work around
                                OpenSSH bug
      --minimize-to-rbi <file.rbi>
                                [experimental] Output a minimal RBI containing the diff
                                between Sorbet's view of a codebase and the definitions
                                present in this file (default: "")
  -h, --help [=SECTION(=all)]   Show help. Can pass an optional SECTION to show help for
                                only one section instead of the default of all sections
      --parser {[original], prism}
                                Which parser to use. Prism support is experimental and
                                still under active development. Correct code should still
                                parse correctly, but error diagnostics and
                                auto-corrections are a work-in-progress. (default:
                                original)

```
