There are a few ways to set up dbt in your local machine, and almost all of them involves Docker in one or the other way. I found the easiest and most straight forward way to install it on your system is using HashiQube. HashiQube is a project to help anyone set up all HashiCorp products in a container or virtual machine (VM) for demo or trial purposes.

Set up dbt using Hashiqube

As I told above, Hashiqube depends on Docker to set up dbt in a local machine, but it also requires Vagrant (a tool from HashiCorp) to install it. So, you need to start with downloading and installing these tools as detailed below:

  1. Download and install Docker Desktop from https://www.docker.com/products/docker-desktop .
  2. Download and install Vagrant from https://www.vagrantup.com/downloads.html .
  3. If you have git in your system, run git clone https://github.com/servian/hashiqube.git. If you have not, then download the archived repo from https://github.com/servian/hashiqube/archive/refs/heads/master.zip .
  4. Switch to the unarchived or cloned-repo’s folder, then run the following commands:
    1cd dbt
    2vagrant up --provision-with basetools,docsify,docker,postgresql,dbt
    
  5. Finally, dbt is set up on your machine. You can go to http://localhost:28080/ to check dbt docs dashboard.

dbt Docs Dashboard
dbt Docs Dashboard

Troubleshooting

1. I see this error: /vagrant/dbt/common.sh: line 2: $'\r': command not found.

This occurs if you’re trying to set up dbt on Windows. Run these commands, then continue from Step #4 above:

 1cd ..
 2del .\hashiqube
 3
 4# Configure Git to not ensure line endings are correct for Windows at checkout
 5# That means line endings will remain at Unix style, which fixes this problem
 6git config --global core.autocrlf false
 7
 8# Clone the repo again to checkout files with line endings using Unix style
 9git clone https://github.com/servian/hashiqube.git
10
11# Configure Git again to ensure line endings are correct for Windows at checkout
12git config --global core.autocrlf true

2. I don’t know what to expect after running the vagrant up command given above.

Please find here the output of this command on Windows (yours may vary per your operating system).

References

  1. HashiQube [ Instructions (original) (archived) ]
  2. HashiQube [ dbt (original) (archived) ]

Let’s discuss.

Get in touch to discuss an idea or project. We can work together to make it live! Or enquire about writing guest posts or speaking in meetups or workshops.