Install dbt CLI

The dbt platform natively supports developing using a command line interface (CLI), empowering team members to contribute with enhanced flexibility and collaboration. The dbt CLI allows you to run dbt commands against your dbt platform development environment from your local command line.

CLI compatibility

The dbt CLI is a dbt platform tool available to users on any available plan. It is not compatible with existing installations of the dbt Core or dbt Fusion engine CLIs.

dbt commands run against the platform's infrastructure and benefit from:

  • Secure credential storage in the dbt platform
  • Automatic deferral of build artifacts to your Cloud project's production environment
  • Speedier, lower-cost builds
  • Support for dbt Mesh (cross-project ref)
  • Significant platform improvements, to be released over the coming months

Diagram of how the dbt CLI works with dbt's infrastructure to run dbt commands from your local command line.Diagram of how the dbt CLI works with dbt's infrastructure to run dbt commands from your local command line.

The dbt CLI is available in all deployment regions and for both multi-tenant and single-tenant accounts.

You can install the dbt CLI via the command line by using one of the following methods:

  • macOS (brew)
  • Windows (native executable)
  • Linux (native executable)
  • Existing dbt Core users (pip)

Before you begin, make sure you have Homebrew installed in your code editor or command line terminal. Refer to the FAQs if your operating system runs into path conflicts.

  1. Verify that you don't already have dbt Core installed by running the following command:

If the output is dbt not found, then that confirms you don't have it installed.

Run pip uninstall dbt to uninstall dbt Core

If you've installed dbt Core globally in some other way, uninstall it first before proceeding:

  1. Install the dbt CLI with Homebrew:

    • First, remove the dbt-labs tap, the separate repository for packages, from Homebrew. This prevents Homebrew from installing packages from that repository:
    • Then, add and install the dbt CLI as a package:
      brew tap dbt-labs/dbt-cli
      brew install dbt
      If you have multiple taps, use brew install dbt-labs/dbt-cli/dbt.
  2. Verify your installation by running dbt --help in the command line. If you see the following output, you installed it correctly:

    The dbt CLI - an ELT tool for running SQL transformations and data models in dbt...

    If you don't see this output, check that you've deactivated pyenv or venv and don't have a global dbt version installed.

    • Note that you no longer need to run the dbt deps command when your environment starts. Previously, initialization required this step. However, you should still run dbt deps if you make any changes to your packages.yml file.
  3. Clone your repository to your local computer using git clone. For example, to clone a GitHub repo using HTTPS format, run git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY.

  4. After cloning your repo, configure the dbt CLI for your dbt project. This lets you run dbt commands like dbt environment show to view your dbt configuration or dbt compile to compile your project and validate models and tests. You can also add, edit, and synchronize files with your repo.

The following instructions explain how to update the dbt CLI to the latest version depending on your operating system.

  • macOS (brew)
  • Windows (executable)
  • Linux (executable)
  • Existing dbt Core users (pip)

To update the dbt CLI, run brew update and then brew upgrade dbt.

The dbt CLI doesn't currently support relative paths in the packages.yml file. Instead, use the Studio IDE, which supports relative paths in this scenario.

Here's an example of a local package configuration in the packages.yml that won't work with the dbt CLI:

# repository_root/my_dbt_project_in_a_subdirectory/packages.yml

packages:
- local: ../shared_macros

In this example, ../shared_macros is a relative path that tells dbt to look for:

  • .. — Go one directory up (to repository_root).
  • /shared_macros — Find the shared_macros folder in the root directory.

To work around this limitation, use the Studio IDE, which fully supports relative paths in packages.yml.

0