Install the Chef Habitat CLI
Chef Habitat provides a command-line interface (CLI) tool called hab that you use to build packages, manage services, and interact with Chef Habitat Builder.
This section includes installation instructions for Linux, macOS, and Windows.
System requirements
Before you install Chef Habitat, confirm that your system meets these requirements.
Operating system and architecture requirements
- Modern Linux kernels on a 64-bit x86_64 processor (Intel or AMD)
- Modern Linux kernels on a 64-bit ARM processor
- Windows Server 2012 or later, or Windows 8 or later on a 64-bit processor
- macOS 14 or later on a 64-bit Apple Silicon or Intel processor
Docker requirements
You need Docker Desktop only if you want to use the Docker-based Chef Habitat Studio, which you invoke with the -D flag.
If you do need Docker Desktop, install it for your platform:
On Linux, you must have Docker Engine installed to export a Chef Habitat artifact to a Docker image.
Chef Habitat doesn’t support alternative containerization platforms.
Install on Linux
Install from the command line
Progress Chef recommends installing Chef Habitat on Linux with the install script.
To install Chef Habitat with the install script:
Export your Chef Habitat Builder auth token:
export HAB_AUTH_TOKEN=<your-token>Run the install script:
curl https://raw.githubusercontent.com/habitat-sh/habitat/main/components/hab/install.sh | sudo -E bashTo install a specific Chef Habitat version, use the
-v <HABITAT_VERSION>flag, for example:curl https://raw.githubusercontent.com/habitat-sh/habitat/main/components/hab/install.sh \ | sudo -E bash -s -- -v 2.0.504
Install manually
Extract the
hab.tgzbinary to/usr/local/binor add its location to yourPATH, for example:tar -xvzf hab.tgz -C /usr/local/bin --strip-components 1
Install on macOS
The following list summarizes what’s supported when running Chef Habitat on macOS:
| Feature | Supported |
|---|---|
hab CLI | Yes |
hab pkg install and package downloads | Yes |
| Build packages (native macOS studio) | Yes |
Build Linux packages (Docker studio with -D flag) | Yes (requires Docker Desktop) |
| Upload packages to Chef Habitat Builder | Yes |
| Habitat Supervisor | No |
| Habitat Services | No |
Install from the command line
Progress Chef recommends installing Chef Habitat on macOS with the install script.
To install Chef Habitat with the install script, follow these steps:
Export your Chef Habitat Builder auth token:
export HAB_AUTH_TOKEN=<your-token>Run the install script:
curl https://raw.githubusercontent.com/habitat-sh/habitat/main/components/hab/install.sh | sudo -E bashTo install a specific Chef Habitat version, use the
-v <HABITAT_VERSION>flag, for example:curl https://raw.githubusercontent.com/habitat-sh/habitat/main/components/hab/install.sh \ | sudo -E bash -s -- -v 2.0.504
Install with Homebrew
To install Chef Habitat with Homebrew, run the following commands:
brew tap habitat-sh/habitat
brew install hab
Install manually
Unzip the Chef Habitat binary to
/usr/local/binto add it to your systemPATH.Remove the quarantine attribute that macOS sets on files downloaded through a browser:
xattr -d com.apple.quarantine /usr/local/bin/hab
Additional setup to build Chef Habitat packages
If you plan to build Chef Habitat packages in Habitat Studio on macOS, you must also install or configure the following dependencies.
Virtual machine environment
The macOS-native Chef Habitat Studio uses sandbox-exec for isolation but shares the /opt/hab filesystem with your host.
Packages installed during a build persist on the host, and builds aren’t guaranteed to be clean between sessions in the same way as Linux chroot-based studios.
To avoid affecting your host Chef Habitat environment, run the macOS native studio inside a virtual machine (for example, UTM or Parallels on Apple Silicon).
Install Xcode Command Line Tools
Chef Habitat Studio on macOS uses the Clang compiler and linker toolkit provided by the Xcode Command Line Tools.
To install the Xcode Command Line Tools, run the following command:
xcode-select --install
Install on Windows
Install with Chocolatey
Progress Chef recommends installing Chef Habitat on Windows with Chocolatey.
To install Chef Habitat with Chocolatey, run the following command:
choco install habitat
Install from the command line
You can install Chef Habitat by downloading and running the installation script:
Set-ExecutionPolicy Bypass -Scope Process -Force
iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/habitat-sh/habitat/main/components/hab/install.ps1'))
You can install a specific Chef Habitat version with -Version <HABITAT_VERSION>, for example:
iex "& { $(irm https://raw.githubusercontent.com/habitat-sh/habitat/main/components/hab/install.ps1) } -Version 2.0.504
Install manually
Unzip the Chef Habitat binary on your computer to
C:\habitatso that the full path to Chef Habitat looks likeC:\habitat\hab-<HABITAT_VERSION>-<YYYYMMDDHHMMSS>-x86_64-windows.For example,
C:\habitat\hab-0.79.1-20190410221450-x86_64-windows.Add that directory to your
PATHvariable:$env:PATH += ";C:\habitat\hab-0.79.1-20190410221450-x86_64-windows\"
Verify installation
To verify your installation, run the following commands:
hab --version
hab cli setup --help