Install dbt Cloud CLI
dbt Cloud natively supports developing using a command line (CLI), empowering team members to contribute with enhanced flexibility and collaboration. The dbt Cloud CLI allows you to run dbt commands against your dbt Cloud development environment from your local command line.
dbt commands are run against dbt Cloud's infrastructure and benefit from:
- Secure credential storage in the dbt Cloud 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
Prerequisites
The dbt Cloud CLI is available in all deployment regions and for both multi-tenant and single-tenant accounts.
Install dbt Cloud CLI
You can install the dbt Cloud CLI on the command line by using one of these methods.
View a video tutorial for a step-by-step guide to installation.
- 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.
- Verify that you don't already have dbt Core installed by running the following command:
which dbt
If the output is dbt not found
, then that confirms you don't have it installed.
pip uninstall dbt
to uninstall dbt CoreIf you've installed dbt Core globally in some other way, uninstall it first before proceeding:
pip uninstall dbt
-
Install the dbt Cloud 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:brew untap dbt-labs/dbt
- Then, add and install the dbt Cloud CLI as a package:
If you have multiple taps, use
brew tap dbt-labs/dbt-cli
brew install dbtbrew install dbt-labs/dbt-cli/dbt
.
- First, remove the
-
Verify your installation by running
dbt --help
in the command line. If you see the following output, your installation is correct:The dbt Cloud CLI - an ELT tool for running SQL transformations and data models in dbt Cloud...
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. This step was previously required during initialization. However, you should still rundbt deps
if you make any changes to yourpackages.yml
file.
- Note that you no longer need to run the
-
Clone your repository to your local computer using
git clone
. For example, to clone a GitHub repo using HTTPS format, rungit clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
. -
After cloning your repo, configure the dbt Cloud CLI for your dbt Cloud project. This lets you run dbt commands like
dbt environment show
to view your dbt Cloud configuration ordbt compile
to compile your project and validate models and tests. You can also add, edit, and synchronize files with your repo.
Refer to the FAQs if your operating system runs into path conflicts.
-
Download the latest Windows release for your platform from GitHub.
-
Extract the
dbt.exe
executable into the same folder as your dbt project.
Advanced users can configure multiple projects to use the same dbt Cloud CLI by:
- Placing the executable file (
.exe
) in the "Program Files" folder - Adding it to their Windows PATH environment variable
- Saving it where needed
Note that if you're using VS Code, you must restart it to pick up modified environment variables.
-
Verify your installation by running
./dbt --help
in the command line. If you see the following output, your installation is correct:The dbt Cloud CLI - an ELT tool for running SQL transformations and data models in dbt Cloud...
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. This step was previously required during initialization. However, you should still rundbt deps
if you make any changes to yourpackages.yml
file.
- Note that you no longer need to run the
-
Clone your repository to your local computer using
git clone
. For example, to clone a GitHub repo using HTTPS format, rungit clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
. -
After cloning your repo, configure the dbt Cloud CLI for your dbt Cloud project. This lets you run dbt commands like
dbt environment show
to view your dbt Cloud configuration ordbt compile
to compile your project and validate models and tests. You can also add, edit, and synchronize files with your repo.
Refer to the FAQs if your operating system runs into path conflicts.
-
Download the latest Linux release for your platform from GitHub. (Pick the file based on your CPU architecture)
-
Extract the
dbt-cloud-cli
binary to the same folder as your dbt project.
tar -xf dbt_0.29.9_linux_amd64.tar.gz
./dbt --version
Advanced users can configure multiple projects to use the same Cloud CLI executable by adding it to their PATH environment variable in their shell profile.
-
Verify your installation by running
./dbt --help
in the command line. If you see the following output, your installation is correct:The dbt Cloud CLI - an ELT tool for running SQL transformations and data models in dbt Cloud...
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. This step was previously required during initialization. However, you should still rundbt deps
if you make any changes to yourpackages.yml
file.
- Note that you no longer need to run the
-
Clone your repository to your local computer using
git clone
. For example, to clone a GitHub repo using HTTPS format, rungit clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
. -
After cloning your repo, configure the dbt Cloud CLI for your dbt Cloud project. This lets you run dbt commands like
dbt environment show
to view your dbt Cloud configuration ordbt compile
to compile your project and validate models and tests. You can also add, edit, and synchronize files with your repo.
If you already have dbt Core installed, the dbt Cloud CLI may conflict. Here are some considerations:
- Prevent conflicts
Use both the dbt Cloud CLI and dbt Core withpip
and create a new virtual environment. - Use both dbt Cloud CLI and dbt Core with brew or native installs
If you use Homebrew, consider aliasing the dbt Cloud CLI as "dbt-cloud" to avoid conflict. For more details, check the FAQs if your operating system experiences path conflicts. - Reverting to dbt Core from the dbt Cloud CLI
If you've already installed the dbt Cloud CLI and need to switch back to dbt Core:
- Uninstall the dbt Cloud CLI using the command:
pip uninstall dbt
- Reinstall dbt Core using the following command, replacing "adapter_name" with the appropriate adapter name:
For example, if I used Snowflake as an adapter, I would run:
python -m pip install dbt-adapter_name --force-reinstall
python -m pip install dbt-snowflake --force-reinstall
- Uninstall the dbt Cloud CLI using the command:
Before installing the dbt Cloud CLI, make sure you have Python installed and your virtual environment venv or pyenv . If you already have a Python environment configured, you can skip to the pip installation step.
Install a virtual environment
We recommend using virtual environments (venv) to namespace cloud-cli
.
-
Create a new virtual environment named "dbt-cloud" with this command:
python3 -m venv dbt-cloud
-
Activate the virtual environment each time you create a shell window or session, depending on your operating system:
- For Mac and Linux, use:
source dbt-cloud/bin/activate
- For Windows, use:
dbt-env\Scripts\activate
- For Mac and Linux, use:
-
(Mac and Linux only) Create an alias to activate your dbt environment with every new shell window or session. You can add the following to your shell's configuration file (for example,
$HOME/.bashrc, $HOME/.zshrc
) while replacing<PATH_TO_VIRTUAL_ENV_CONFIG>
with the path to your virtual environment configuration:alias env_dbt='source <PATH_TO_VIRTUAL_ENV_CONFIG>/bin/activate'
Install dbt Cloud CLI in pip
- (Optional) If you already have dbt Core installed, this installation will override that package. Check your dbt Core version in case you need to reinstall it later by running the following command :
dbt --version
- Make sure you're in your virtual environment and run the following command to install the dbt Cloud CLI:
pip install dbt --no-cache-dir
If there are installation issues, running the command with the --force-reinstall
argument might help:
pip install dbt --no-cache-dir --force-reinstall
- (Optional) To revert to dbt Core, first uninstall both the dbt Cloud CLI and dbt Core. Then reinstall dbt Core.
pip uninstall dbt-core dbt
pip install dbt-adapter_name --force-reinstall
-
Clone your repository to your local computer using
git clone
. For example, to clone a GitHub repo using HTTPS format, rungit clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
. -
After cloning your repo, configure the dbt Cloud CLI for your dbt Cloud project. This lets you run dbt commands like
dbt environment show
to view your dbt Cloud configuration ordbt compile
to compile your project and validate models and tests. You can also add, edit, and synchronize files with your repo.
Update dbt Cloud CLI
The following instructions explain how to update the dbt Cloud 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 Cloud CLI, run brew update
and then brew upgrade dbt
.
To update, follow the same process explained in Windows and replace the existing dbt.exe
executable with the new one.
To update, follow the same process explained in Linux and replace the existing dbt
executable with the new one.
To update:
- Make sure you're in your virtual environment
- Run
python -m pip install --upgrade dbt
.
VS Code extension beta
Visual Studio (VS) Code extensions enhance command line tools by adding extra functionalities. Power user for dbt Core and dbt Cloud is a common extension used to enhance your dbt development with VS Code.
You can use the dbt Cloud CLI with Power User for dbt Core and dbt Cloud by following the instructions here.
The Power User extension will handle installing the Cloud CLI on your behalf.