Install StackGen CLI
This guide covers both installing and uninstalling the StackGen CLI on different operating systems.
Install
To install StackGen CLI, follow the appropriate method based on your operating system:
macOS
Click to view
Install Homebrew if not already installed by running:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install StackGen:
brew install stackgenhq/stackgen/stackgen
Verify the Installation:
stackgen version
Updating StackGen CLI on macOS
Update StackGen CLI using:
brew upgrade stackgen
You can verify the updated version with:
stackgen version
Linux
Click to view
Follow these steps to install StackGen using Homebrew on your Linux system.
-
Install Git: Git is required for Homebrew and StackGen.
sudo yum install git -y -
Install Homebrew: Homebrew is a package manager that simplifies software installation. Set up the environment path:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -
Configure Homebrew for Your Shell: Add Homebrew to your shell’s environment variables. If you’re using a different shell like
zshorfish, replace.bashrcaccordingly.echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.bashrc -
Apply the Changes: Reload your shell configuration so the new settings take effect.
source ~/.bashrc -
Install StackGen: Now use Homebrew to install StackGen.
brew install stackgenhq/stackgen/stackgen
Update StackGen CLI on Linux
Update StackGen CLI using:
brew upgrade stackgen
You can verify the updated version with:
stackgen --version
Windows
StackGen CLI can be used on Windows in the following ways:
Option 1: Using Docker
Click to view
StackGen CLI runs on Windows using Docker. To start a StackGen CLI container, use the following command:
docker run -it --rm -p 50525:50525 -v ~/.stackgen:/home/stackgen/.stackgen ghcr.io/stackgenhq/stackgen:latest
This command launches a temporary StackGen CLI container, switching the terminal prompt to the StackGen CLI environment where StackGen commands can be executed.
Updating StackGen CLI with Docker
If you're using the Docker-based CLI, pull the latest image:
docker pull ghcr.io/stackgenhq/stackgen:latest
Then run the CLI as usual:
docker run -it --rm -p 50525:50525 -v ~/.stackgen:/home/stackgen/.stackgen ghcr.io/stackgenhq/stackgen:latest
Option 2: Using Windows Subsystem for Linux (WSL)
Click to view
Alternatively, users can install WSL and run the StackGen CLI using the Linux installation steps. This approach allows for a native Linux environment within Windows.
- Install WSL and a Linux distribution (e.g., Ubuntu) by following the WSL installation guide.
- Open WSL and follow the Linux installation steps above.
Updating StackGen CLI with WSL
If you're using WSL with Homebrew, follow the same upgrade command as Linux/macOS:
brew upgrade stackgen
You can verify the updated version with:
stackgen version
Option 3: Using .exe File
Click to view
-
Install Terraform: Check if you’ve installed Terraform by running the following command:
terraform versionTo install Terraform, run the following command:
- Chocolatey
- Scoop
tipWe recommend that you use Chocolatey for installing Terraform on Windows.
If you have Chocolatey installed, run:
choco install terraformIf you don’t have Chocolatey, install it from chocolatey.org.
Scoop is another Windows Package Manager that you can choose to install Terraform with.
Run the following command:
scoop install terraformIf you do not have Scoop installed, check out the scoop.sh documentation.
-
Downlodad
stackgen.exe: To Download the.exefile, click the link https://releases.stackgen.com/binaries/v0.69.0/stackgen-cli_0.69.0_windows_amd64.zip. -
Set up StackGen CLI using
.exe: To use the StackGen CLI on Windows, add the folder containing the.exefile to your System Environment Variables under the Path variable. This lets you to run the Cloud-to-Code CLI directly from the terminal window. Follow these steps to set up the StackGen CLI:-
Extract the contents of the
.zipfile and save the executable (.exe) files in a folder you want to add to your systemPATH. -
Open Start and search for Edit the system environment variables, and then open it.
-
In the System Properties window, click Environment Variables.
-
Under User variables, find and select the Path variable, then click Edit.
-
In the Edit Environment Variable window, click New.
-
Paste the full folder path where the
.exefile is stored (e.g.,C:\Tools\stackgen), then click OK to save. -
Restart your terminal and run the Cloud-to-Code CLI to confirm it works:
stackgen --version
-
Update StackGen CLI
To update your StackGen CLI with the latest version, run the following command:
- Chocolatey
- Scoop
If you have Chocolatey installed, run:
choco upgrade stackgen
If you don’t have Chocolatey, install it from chocolatey.org.
Run the following command:
scoop update stackgen
If you do not have Scoop installed, check out the scoop.sh documentation.
Install StackGen CLI Dependencies
Click to view
You will need to install the following before you provision or deploy your appStacks:
- terraform: Refer to the terraform documentation to install terraform.
- OpenTofu: Follow the steps to install OpenTofu.
Uninstall
Click to view
If you need to uninstall StackGen CLI from your system, follow the appropriate instructions for your operating system:
macOS
To uninstall StackGen CLI from macOS:
brew uninstall stackgen
Linux
To uninstall StackGen CLI from Linux:
brew uninstall stackgen
Windows
From Docker
If you've been using StackGen CLI with Docker, there's no formal uninstallation needed as each container is temporary.
To remove the Docker image:
docker rmi ghcr.io/stackgenhq/stackgen:latest
You can also remove any related Docker volumes if desired:
docker volume prune
From WSL
To uninstall StackGen CLI from Windows Subsystem for Linux:
- Open your WSL terminal
- Run the same uninstall command as Linux:
brew uninstall stackgen