Skip to content

Instantly share code, notes, and snippets.

@TotalLag
Last active December 31, 2025 18:58
Show Gist options
  • Select an option

  • Save TotalLag/fee2b47ccc9bf42006eb3e26fc0663d4 to your computer and use it in GitHub Desktop.

Select an option

Save TotalLag/fee2b47ccc9bf42006eb3e26fc0663d4 to your computer and use it in GitHub Desktop.
sh: 1: <command>: not found

Setup CLI Tools for Codespaces

Workflow for setting up CLI tools and ensuring they are automatically available in new GitHub Codespaces sessions.

Prerequisites

  • GitHub Codespaces environment
  • zsh shell (default in Codespaces)

Steps

1. Install Bun Package Manager

curl -fsSL https://bun.sh/install | bash

2. Configure Universal PATH in ~/.zshrc

Add this configuration to automatically detect common CLI tool installation directories:

cat >> ~/.zshrc << 'ZSHCONFIG'

# ============================================
# Universal CLI Tools PATH Configuration
# Automatically includes common installation directories
# ============================================

# Bun
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"

# Common user-local binary directories
export PATH="$HOME/bin:$HOME/.local/bin:$PATH"

# Language-specific package managers
export PATH="$HOME/.cargo/bin:$PATH"          # Rust/Cargo
export PATH="$HOME/go/bin:$PATH"              # Go
export PATH="$HOME/.deno/bin:$PATH"           # Deno
export PATH="$HOME/.npm-global/bin:$PATH"     # npm global (if configured)

# Cloud CLIs
export PATH="$HOME/.local/bin:$PATH"          # pip/pipx installs (AWS CLI, etc.)

# Auto-source any tool-specific configs if they exist
[[ -f "$HOME/.cargo/env" ]] && source "$HOME/.cargo/env"
[[ -f "$HOME/.ghcup/env" ]] && source "$HOME/.ghcup/env"  # Haskell

# Function to add a directory to PATH if it exists
add_to_path() {
  [[ -d "$1" ]] && export PATH="$1:$PATH"
}

# Scan for common tool installation patterns
add_to_path "$HOME/.yarn/bin"
add_to_path "$HOME/.config/yarn/global/node_modules/.bin"
add_to_path "$HOME/.pnpm-global/bin"
add_to_path "$HOME/.volta/bin"
add_to_path "$HOME/.fnm"
add_to_path "$HOME/.asdf/bin"
add_to_path "$HOME/.sdkman/candidates/java/current/bin"
add_to_path "$HOME/.pyenv/bin"
add_to_path "$HOME/.rbenv/bin"
ZSHCONFIG

3. Apply Changes

source ~/.zshrc

4. Install Project Dependencies

bun install

Common CLI Tool Installations

AWS CLI

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip && sudo ./aws/install
rm -rf awscliv2.zip aws/

Rust/Cargo

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.zshrc

Go

# Install via apt or download from golang.org
sudo apt-get update && sudo apt-get install -y golang-go

Deno

curl -fsSL https://deno.land/install.sh | sh
source ~/.zshrc

GitHub CLI (if not pre-installed)

type -p curl >/dev/null || sudo apt install curl -y
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update && sudo apt install gh -y

Auto-Detection Coverage

The PATH configuration automatically detects tools installed in:

Tool Category Installation Path
Bun ~/.bun/bin
Rust/Cargo ~/.cargo/bin
Go ~/go/bin
Deno ~/.deno/bin
AWS CLI (pip) ~/.local/bin
npm global ~/.npm-global/bin
Yarn ~/.yarn/bin
pnpm ~/.pnpm-global/bin
Volta ~/.volta/bin
fnm ~/.fnm
asdf ~/.asdf/bin
SDKMAN (Java) ~/.sdkman/candidates/java/current/bin
pyenv ~/.pyenv/bin
rbenv ~/.rbenv/bin

Verification

After setup, verify tools are available:

bun --version
node --version
# Add other tools as needed
aws --version

Making CLI Tools Available to Kilo Code

Kilo Code executes commands via /bin/sh, which doesn't source shell configuration files like ~/.zshrc or ~/.bashrc. To make CLI tools available to Kilo Code, create symlinks in /usr/local/bin:

Bun

sudo ln -sf ~/.bun/bin/bun /usr/local/bin/bun
sudo ln -sf ~/.bun/bin/bunx /usr/local/bin/bunx

Deno

sudo ln -sf ~/.deno/bin/deno /usr/local/bin/deno

Cargo-installed tools

# Example for a cargo-installed tool like 'ripgrep'
sudo ln -sf ~/.cargo/bin/rg /usr/local/bin/rg

Generic pattern

# For any tool installed in a user directory:
sudo ln -sf /home/codespace/.tool/bin/toolname /usr/local/bin/toolname

Verification

After creating symlinks, verify Kilo Code can access the tools by running:

which bun && bun --version

This should work in any shell, including /bin/sh.

Notes

  • New terminal sessions will automatically have all configured paths
  • Tools installed to standard locations will be auto-detected
  • For tools with custom install locations, add them using add_to_path "/custom/path"
  • The devcontainer.json in the project can also pre-install tools for team consistency
  • For Kilo Code access: Always create symlinks in /usr/local/bin for tools installed in user directories
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment