OS Manuals

/usr/bin/solc

Solidity smart contract compiler

From solc 0.8.38-r0 (enterprise-packages), captured 2026-11-08 by running solc --help (exit 0). permalink

solc, the Solidity commandline compiler.

This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you
are welcome to redistribute it under certain conditions. See 'solc --license'
for details.

Usage: solc [options] [input_file...]
Compiles the given Solidity input files (or the standard input if "-" is
used as a file name) and outputs the components specified in the options
at standard output or in files in the output directory, if specified.
Imports are automatically read from the filesystem, but it is also possible to
remap paths using the context:prefix=path syntax.
Example:
solc --bin -o /tmp/solcoutput dapp-bin=/usr/local/lib/dapp-bin contract.sol

General Information:
  --help               Show help message and exit.
  --version            Show version and exit.
  --license            Show licensing information and exit.
  --input-file arg     input file

Input Options:
  --base-path path     Use the given path as the root of the source tree
                       instead of the root of the filesystem.
  --include-path path  Make an additional source directory available to the
                       default import callback. Use this option if you want to
                       import contracts whose location is not fixed in relation
                       to your main source tree, e.g. third-party libraries
                       installed using a package manager. Can be used multiple
                       times. Can only be used if base path has a non-empty
                       value.
  --allow-paths path(s)
                       Allow a given path for imports. A list of paths can be
                       supplied by separating them with a comma.
  --ignore-missing     Ignore missing files.
  --no-import-callback
                       Disable the default import callback to prevent the
                       compiler from loading any source files not listed on the
                       command line or given in the Standard JSON input.

Output Options:
  -o [ --output-dir ] path
                       If given, creates one file per output component and
                       contract/file at the specified directory.
  --overwrite          Overwrite existing files (used together with -o).
  --evm-version version (=osaka)
                       Select desired EVM version: homestead, tangerineWhistle,
                       spuriousDragon, byzantium, constantinople, petersburg,
                       istanbul, berlin, london, paris, shanghai, cancun,
                       prague, osaka, amsterdam (experimental), or @future
                       (experimental).
  --experimental-via-ir
                       Deprecated synonym of --via-ir.
  --via-ir             Turn on compilation via IR.
  --via-ssa-cfg        (experimental) Turn on SSA CFG-based code generation.
                       Implies compilation via IR.
  --revert-strings debug,default,strip,verboseDebug
                       Strip revert (and require) reason strings or add
                       additional debugging information. Note that 'strip' does
                       not remove custom errors.
  --debug-info arg (=ast-id,location,snippet)
                       Debug info components to be included in the produced EVM
                       assembly and Yul code. Value can be 'all', 'none' or a
                       comma-separated list containing one or more of the
                       following components: ast-id, location, snippet, or
                       ethdebug (experimental). Note that 'all' does not
                       include experimental components.
  --stop-after stage   Stop execution after the given compiler stage. Valid
                       options: "parsing".

Alternative Input Modes:
  --standard-json      Switch to Standard JSON input / output mode, ignoring
                       all options. It reads from standard input, if no input
                       file was given, otherwise it reads from the provided
                       input file. The result will be written to standard
                       output.
  --link               Switch to linker mode, ignoring all options apart from
                       --libraries and modify binaries in place.
  --strict-assembly    Switch to strict assembly mode and assume input is
                       strict assembly.
  --import-ast         (experimental) Resume compilation from an abstract
                       syntax tree (AST) representing already parsed and
                       analyzed Solidity code. In this mode the compiler
                       expects exactly one input file, containing an AST in
                       compact JSON format, as produced by --ast-compact-json,
                       --ast ast or the 'ast' output in Standard JSON.
  --import-asm-json    (experimental) Resume compilation from EVM assembly. In
                       this mode the compiler expects exactly one input file,
                       containing assembly in JSON format, as produced by
                       --import-asm-jsonor the 'evm.legacyAssembly' output in
                       Standard JSON. WARNING: --import-asm-json output is
                       already optimized according to settings stored in
                       metadata. Using --optimize in this mode is allowed, but
                       not necessary under normal circumstances. --optimize
                       forces the optimizer to run again and can produce
                       bytecode that is not reproducible from metadata.

Assembly Mode Options:
  --machine evm        Target machine in assembly or Yul mode.
  --yul-dialect evm    Input dialect to use in assembly or yul mode.

Linker Mode Options:
  --libraries libs     Direct string or file containing library addresses.
                       Syntax: <libraryName>=<address> [, or whitespace] ...
                       Address is interpreted as a hex string prefixed by 0x.

Output Formatting:
  --pretty-json        Output JSON in pretty format.
  --json-indent N (=2) Indent pretty-printed JSON with N spaces. Enables
                       '--pretty-json' automatically.
  --color              Force colored output.
  --no-color           Explicitly disable colored output, disabling terminal
                       auto-detection.
  --error-codes        Output error codes.

Output Components:
  --ast-compact-json   AST of all source files in a compact JSON format.
  --asm                EVM assembly of the contracts.
  --asm-json           EVM assembly of the contracts in JSON format.
  --opcodes            Opcodes of the contracts.
  --bin                Binary of the contracts in hex.
  --bin-runtime        Binary of the runtime part of the contracts in hex.
  --abi                ABI specification of the contracts.
  --ir                 Intermediate Representation (IR) of all contracts.
  --ir-ast-json        (experimental) AST of Intermediate Representation (IR)
                       of all contracts in a compact JSON format.
  --ir-optimized       Optimized Intermediate Representation (IR) of all
                       contracts.
  --ir-optimized-ast-json
                       (experimental) AST of optimized Intermediate
                       Representation (IR) of all contracts in a compact JSON
                       format.
  --hashes             Function signature hashes of the contracts.
  --userdoc            Natspec user documentation of all contracts.
  --devdoc             Natspec developer documentation of all contracts.
  --metadata           Combined Metadata JSON whose IPFS hash is stored
                       on-chain.
  --storage-layout     Slots, offsets and types of the contract's state
                       variables located in storage.
  --transient-storage-layout
                       Slots, offsets and types of the contract's state
                       variables located in transient storage.
  --ethdebug-resources
                       (experimental) Global ethdebug output
                       (ethdebug/format/info/resources schema) containing
                       source list and compiler info.
  --ethdebug-compilation
                       (experimental) Global ethdebug compilation output (the
                       'compilation' key from ethdebug/format/info/resources
                       schema).
  --ethdebug-program   (experimental) Debug information in ethdebug format for
                       all contracts (ethdebug/format/program schema for
                       creation bytecode).
  --ethdebug-program-runtime
                       (experimental) Debug information in ethdebug format for
                       the runtime part of all contracts
                       (ethdebug/format/program schema for deployed bytecode).

Extra Output:
  --gas                Print an estimate of the maximal gas usage for each
                       function.
  --combined-json abi,asm,ast,bin,bin-runtime,devdoc,function-debug,function-debug-runtime,generated-sources,generated-sources-runtime,hashes,metadata,opcodes,srcmap,srcmap-runtime,storage-layout,transient-storage-layout,userdoc
                       Output a single json document containing the specified
                       information.

Metadata Options:
  --no-cbor-metadata   Do not append CBOR metadata to the end of the bytecode.
  --metadata-hash ipfs,none,swarm
                       Choose hash method for the bytecode metadata or disable
                       it.
  --metadata-literal   Store referenced sources as literal data in the metadata
                       output.

Optimizer Options:
  --optimize           Enable optimizer.
  --optimize-runs n (=200)
                       The number of runs specifies roughly how often each
                       opcode of the deployed code will be executed across the
                       lifetime of the contract. Lower values will optimize
                       more for initial deployment cost, higher values will
                       optimize more for high-frequency usage.
  --optimize-yul       Enable Yul optimizer (independently of the EVM assembly
                       optimizer). The general --optimize option automatically
                       enables this unless --no-optimize-yul is specified.
  --no-optimize-yul    Disable Yul optimizer (independently of the EVM assembly
                       optimizer).
  --yul-optimizations steps
                       Forces Yul optimizer to use the specified sequence of
                       optimization steps instead of the built-in one.

Model Checker Options:
  --model-checker-contracts default,<source>:<contract> (=default)
                       Select which contracts should be analyzed using the form
                       <source>:<contract>.Multiple pairs <source>:<contract>
                       can be selected at the same time, separated by a comma
                       and no spaces.
  --model-checker-div-mod-no-slacks
                       Encode division and modulo operations with their precise
                       operators instead of multiplication with slack
                       variables.
  --model-checker-engine all,bmc,chc,none (=none)
                       Select model checker engine.
  --model-checker-ext-calls untrusted,trusted (=untrusted)
                       Select whether to assume (trusted) that external calls
                       always invoke the code given by the type of the
                       contract, if that code is available.
  --model-checker-invariants default,all,contract,reentrancy (=default)
                       Select whether to report inferred contract inductive
                       invariants. Multiple types of invariants can be selected
                       at the same time, separated by a comma and no spaces. By
                       default no invariants are reported.
  --model-checker-print-query
                       Print the queries created by the SMTChecker in the
                       SMTLIB2 format.
  --model-checker-show-proved-safe
                       Show all targets that were proved safe separately.
  --model-checker-show-unproved
                       Show all unproved targets separately.
  --model-checker-show-unsupported
                       Show all unsupported language features separately.
  --model-checker-solvers cvc5,eld,z3,smtlib2 (=z3)
                       Select model checker solvers.
  --model-checker-targets default,all,constantCondition,underflow,overflow,divByZero,balance,assert,popEmptyArray,outOfBounds (=default)
                       Select model checker verification targets.Multiple
                       targets can be selected at the same time, separated by a
                       comma and no spaces. By default all targets except
                       underflow and overflow are selected.
  --model-checker-timeout ms
                       Set model checker timeout per query in milliseconds.The
                       default is a deterministic resource limit.A timeout of 0
                       means no resource/time restrictions for any query.
  --model-checker-bmc-loop-iterations arg
                       Set loop unrolling depth for BMC engine.Default is 1.

Experimental options:
  --experimental       Enable experimental mode. This flag does not activate
                       any experimental features on its own - it unlocks the
                       ability to use them through the usual flags and pragmas.
Options (65)
OptionDescriptionSource
--helpShow help message and exit.help
--versionShow version and exit.help
--licenseShow licensing information and exit.help
--input-file arginput filehelp
--base-path pathUse the given path as the root of the source tree instead of the root of the filesystem.help
--include-path pathMake an additional source directory available to the default import callback.help
--allow-paths path(s)Allow a given path for imports.help
--ignore-missingIgnore missing files.help
--no-import-callbackDisable the default import callback to prevent the compiler from loading any source files not listed on the command line or given in the Standard JSON input.help
--overwriteOverwrite existing files (used together with -o).help
--experimental-via-irDeprecated synonym of --via-ir.help
--via-irTurn on compilation via IR.help
--via-ssa-cfg(experimental) Turn on SSA CFG-based code generation.help
--revert-strings debugStrip revert (and require) reason strings or add additional debugging information.help
--stop-after stageStop execution after the given compiler stage.help
--standard-jsonSwitch to Standard JSON input / output mode, ignoring all options.help
--linkSwitch to linker mode, ignoring all options apart fromhelp
--strict-assemblySwitch to strict assembly mode and assume input is strict assembly.help
--import-ast(experimental) Resume compilation from an abstract syntax tree (AST) representing already parsed and analyzed Solidity code.help
--import-asm-json(experimental) Resume compilation from EVM assembly.help
--machine evmTarget machine in assembly or Yul mode.help
--yul-dialect evmInput dialect to use in assembly or yul mode.help
--libraries libsDirect string or file containing library addresses.help
--pretty-jsonOutput JSON in pretty format.help
--colorForce colored output.help
--no-colorExplicitly disable colored output, disabling terminal auto-detection.help
--error-codesOutput error codes.help
--ast-compact-jsonAST of all source files in a compact JSON format.help
--asmEVM assembly of the contracts.help
--asm-jsonEVM assembly of the contracts in JSON format.help
--opcodesOpcodes of the contracts.help
--binBinary of the contracts in hex.help
--bin-runtimeBinary of the runtime part of the contracts in hex.help
--abiABI specification of the contracts.help
--irIntermediate Representation (IR) of all contracts.help
--ir-ast-json(experimental) AST of Intermediate Representation (IR) of all contracts in a compact JSON format.help
--ir-optimizedOptimized Intermediate Representation (IR) of all contracts.help
--ir-optimized-ast-json(experimental) AST of optimized Intermediate Representation (IR) of all contracts in a compact JSON format.help
--hashesFunction signature hashes of the contracts.help
--userdocNatspec user documentation of all contracts.help
--devdocNatspec developer documentation of all contracts.help
--metadataCombined Metadata JSON whose IPFS hash is stored on-chain.help
--storage-layoutSlots, offsets and types of the contract's state variables located in storage.help
--transient-storage-layoutSlots, offsets and types of the contract's state variables located in transient storage.help
--ethdebug-resources(experimental) Global ethdebug output (ethdebug/format/info/resources schema) containing source list and compiler info.help
--ethdebug-compilation(experimental) Global ethdebug compilation output (the 'compilation' key from ethdebug/format/info/resources schema).help
--ethdebug-program(experimental) Debug information in ethdebug format for all contracts (ethdebug/format/program schema for creation bytecode).help
--ethdebug-program-runtime(experimental) Debug information in ethdebug format for the runtime part of all contracts (ethdebug/format/program schema for deployed bytecode).help
--gasPrint an estimate of the maximal gas usage for each function.help
--combined-json abiOutput a single json document containing the specified information.help
--no-cbor-metadataDo not append CBOR metadata to the end of the bytecode.help
--metadata-hash ipfsChoose hash method for the bytecode metadata or disable it.help
--metadata-literalStore referenced sources as literal data in the metadata output.help
--optimizeEnable optimizer.help
--optimize-yulEnable Yul optimizer (independently of the EVM assembly optimizer).help
--no-optimize-yulDisable Yul optimizer (independently of the EVM assembly optimizer).help
--yul-optimizations stepsForces Yul optimizer to use the specified sequence of optimization steps instead of the built-in one.help
--model-checker-div-mod-no-slacksEncode division and modulo operations with their precise operators instead of multiplication with slack variables.help
--model-checker-print-queryPrint the queries created by the SMTChecker in the SMTLIB2 format.help
--model-checker-show-proved-safeShow all targets that were proved safe separately.help
--model-checker-show-unprovedShow all unproved targets separately.help
--model-checker-show-unsupportedShow all unsupported language features separately.help
--model-checker-timeout msSet model checker timeout per query in milliseconds.The default is a deterministic resource limit.A timeout of 0 means no resource/time restrictions for any query.help
--model-checker-bmc-loop-iterations argSet loop unrolling depth for BMC engine.Default is 1.help
--experimentalEnable experimental mode.help

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