Gum: Glamorous Shell Scripts with Interactive UI Components

Gum: Glamorous Shell Scripts with Interactive UI Components

Summary

Gum is a command-line tool from Charmbracelet designed to inject glamorous, interactive UI components into your shell scripts. It empowers developers to create engaging command-line experiences, leveraging the power of Bubbles and Lip Gloss without needing to write Go code. Easily add prompts, spinners, tables, and other interactive elements to make your scripts more user-friendly and visually appealing.

Repository Info

Updated on December 20, 2025
View on GitHub

Tags

Click on any tag to explore related repositories

Introduction

Gum is an open-source command-line tool developed by Charmbracelet, renowned for creating visually stunning and highly functional terminal applications. It enables you to enhance your shell scripts with a variety of interactive UI components, transforming mundane scripts into glamorous and user-friendly experiences. Built on top of Charmbracelet's popular Bubbles and Lip Gloss libraries, Gum provides ready-to-use utilities like input prompts, confirmations, file pickers, spinners, and more, all accessible directly from your Bash or Zsh scripts.

Installation

Installing Gum is straightforward, with multiple options available depending on your operating system and preferred package manager.

Using a package manager:

# macOS or Linux
brew install gum

# Arch Linux
pacman -S gum

# Nix
nix-env -iA nixpkgs.gum

# Flox
flox install gum

# Windows (via WinGet or Scoop)
winget install charmbracelet.gum
scoop install charm-gum

For Debian/Ubuntu, Fedora/RHEL/OpenSuse, and FreeBSD, detailed instructions are available in the official Gum README.

Download binaries or packages:

Pre-compiled packages and binaries are available for various platforms including Linux, macOS, Windows, and BSDs.

Install with Go:

If you have Go installed, you can also install Gum directly:

go install github.com/charmbracelet/gum@latest

Examples

Gum offers a wide array of commands to make your shell scripts more interactive and powerful. Here are a few examples demonstrating its utility:

1. Crafting Conventional Commits: Combine gum choose, gum input, and gum write to create a guided commit message workflow.

TYPE=$(gum choose "fix" "feat" "docs" "style" "refactor" "test" "chore" "revert")
SCOPE=$(gum input --placeholder "scope")
SUMMARY=$(gum input --value "$TYPE$SCOPE: " --placeholder "Summary of this change")
DESCRIPTION=$(gum write --placeholder "Details of this change")
gum confirm "Commit changes?" && git commit -m "$SUMMARY" -m "$DESCRIPTION"

2. Interactive File Selection for Editor: Open a file selected interactively using gum file.

$EDITOR $(gum file $HOME)

3. Selecting a tmux Session: Filter and select an active tmux session.

SESSION=$(tmux list-sessions -F \#S | gum filter --placeholder "Pick session...")
tmux switch-client -t "$SESSION" || tmux attach -t "$SESSION"

4. Uninstalling Multiple Packages: Interactively choose multiple packages to uninstall using gum choose.

brew list | gum choose --no-limit | xargs brew uninstall

For more examples and detailed usage, refer to the examples directory in the repository.

Why Use Gum?

Gum empowers developers to elevate their shell scripts from basic automation to sophisticated, interactive command-line applications.

  • Enhanced User Experience: Replace plain text prompts with visually appealing and interactive elements like spinners, choices, and input fields.
  • Simplified Scripting: Leverage pre-built, highly configurable UI components without needing to delve into complex UI programming or Go development.
  • Increased Productivity: Streamline workflows by making scripts more intuitive and less error-prone, guiding users through complex operations.
  • Modern Aesthetics: Bring the signature Charmbracelet style, known for its elegant and minimalist design, directly to your terminal scripts.

Links