forge - Build, test, fuzz, debug and deploy Solidity contracts.


forge [options] command [args]
forge [options] --version
forge [options] --help


This program is a set of tools to build, test, fuzz, debug and deploy Solidity smart contracts.


General Commands

forge help
    Display help information about Forge.

forge completions
    Generate shell autocompletions for Forge.

Project Commands

forge init
    Create a new Forge project.

forge clone
    Clone a on-chain verified contract as a Forge project.

forge install
    Install one or multiple dependencies.

forge update
    Update one or multiple dependencies.

forge remove
    Remove one or multiple dependencies.

forge config
    Display the current config.

forge remappings
    Get the automatically inferred remappings for this project.

forge tree
    Display a tree visualization of the project’s dependency graph.

forge geiger     Detects usage of unsafe cheat codes in a foundry project and its dependencies.

Build Commands

forge build
    Build the project’s smart contracts.

forge clean
    Remove the build artifacts and cache directories.

forge inspect
    Get specialized information about a smart contract.

Test Commands

forge test
    Run the project’s tests.

forge snapshot
    Create a snapshot of each test’s gas usage.

forge coverage
    Generate coverage reports.

Deploy Commands

forge create
    Deploy a smart contract.

forge verify-contract
    Verify smart contracts on Etherscan.

forge verify-check
    Check verification status on Etherscan.

forge flatten
    Flatten a source file and all of its imports into one file.

Utility Commands

forge debug
    Debug a single smart contract as a script.

forge bind
    Generate Rust bindings for smart contracts.

forge cache
    Manage the Foundry cache.

forge cache clean
    Cleans cached data from ~/.foundry.

forge cache ls
    Shows cached data from ~/.foundry.

forge script
    Run a smart contract as a script, building transactions that can be sent onchain.

forge upload-selectors
    Uploads abi of given contract to function selector database.

forge doc
    Generate documentation for Solidity source files.


Special Options

    Print version info and exit.

Common Options

    Prints help information.


    Default location for Foundry’s “home” directory where it stores various files.

    Binaries installed using foundryup will be located here.

    Forge’s cache directory, where it stores cached block data and more.

    The global Foundry config.

    The location of the Forge-managed solc binaries.


  1. Create a new Forge project:

    forge init hello_foundry
  2. Build a project:

    forge build
  3. Run a project’s tests:

    forge test


See for issues.