Your AI Command Line Companions - All in One Script
This directory contains scripts to install and configure multiple AI CLI tools, bringing the power of Claude, GPT, and Gemini right into your terminal.
- Latest Claude models in your terminal
- Stream responses in real-time
- Context-aware conversations
- Project-specific configurations
- GPT-4 and GPT-3.5 Turbo access
- Code generation and explanation
- Chat-style interactions
- Customizable model selection
- Google's Gemini models
- Multi-modal capabilities
- Browser-based or API key authentication
- Fast inference
- OS: Linux (Debian/Ubuntu), Raspberry Pi, or macOS
- Architecture: x86_64 or aarch64 (ARM64)
- Shell: bash or zsh
curlfor downloadsbuild-essentialor build tools for native modulespython3andpipfor some dependencies- Active internet connection
The script will install:
- Node.js 22.x LTS (via NodeSource)
- npm (Node Package Manager)
- All required CLI tools
cd AI-CLI-setup
./install-ai-cli.shThe script will:
- ✅ Install system prerequisites (curl, build tools, Python)
- ✅ Install Node.js 22.x LTS
- ✅ Configure npm to use a user-local prefix (
~/.npm-global) - ✅ Install all three AI CLIs globally
- ❓ Prompt for API keys (optional)
- ✅ Add PATH exports to your shell RC file
- ✅ Verify installations
[1/6] Installing system prerequisites
[2/6] Installing Node.js 22.x
[3/6] Configuring npm to use a user prefix
[4/6] Installing CLIs to $HOME
[5/6] Capturing API keys (optional, press Enter to skip)
[6/6] Verifying installations
During installation, you'll be prompted for:
-
OpenAI API Key (
OPENAI_API_KEY)- Get yours at: https://platform.openai.com/api-keys
- Used by Codex CLI
-
Anthropic API Key (
ANTHROPIC_API_KEY)- Get yours at: https://console.anthropic.com/
- Used by Claude Code CLI
-
Google API Key (
GOOGLE_API_KEY)- Get yours at: https://aistudio.google.com/app/apikey
- Optional - can use browser auth instead
You can skip any or all during installation and set them up later.
# Reload your shell configuration
source ~/.bashrc # or ~/.zshrc for zsh users
# Or just open a new terminal# Check versions
codex --version
claude --version
gemini --version
# Test basic commands
codex --help
claude --help
gemini --help# Set default model
codex config set model gpt-4-turbo
# Ask a question
codex "Explain recursion in Python"
# Generate code
codex "Write a function to find prime numbers"
# Interactive chat
codex chat# Check authentication
claude auth status
# Start a conversation
claude "What's the difference between async and sync in JavaScript?"
# Use with files
claude "Review this code" < script.js
# Configure default model
claude config set model claude-3-5-sonnet-20241022# Login via browser
gemini auth login
# Or use API key (already set if you provided it during install)
export GOOGLE_API_KEY="your-key-here"
# Ask questions
gemini "Explain quantum computing simply"
# Generate content
gemini "Write a haiku about programming"If you skipped key setup during installation:
# Add to your shell RC file (~/.bashrc or ~/.zshrc)
echo 'export OPENAI_API_KEY="sk-..."' >> ~/.bashrc
echo 'export ANTHROPIC_API_KEY="sk-ant-..."' >> ~/.bashrc
echo 'export GOOGLE_API_KEY="..."' >> ~/.bashrc
# Reload
source ~/.bashrcecho $OPENAI_API_KEY
echo $ANTHROPIC_API_KEY
echo $GOOGLE_API_KEY# Store in keychain
security add-generic-password -s "AI-CLI" -a "OPENAI_API_KEY" -w "sk-..."
security add-generic-password -s "AI-CLI" -a "ANTHROPIC_API_KEY" -w "sk-ant-..."
security add-generic-password -s "AI-CLI" -a "GOOGLE_API_KEY" -w "..."
# Retrieve when needed
export OPENAI_API_KEY=$(security find-generic-password -s "AI-CLI" -a "OPENAI_API_KEY" -w)Solution: Your PATH isn't set up correctly.
# Add to ~/.bashrc or ~/.zshrc
export PATH="$HOME/.npm-global/bin:$PATH"
# Reload
source ~/.bashrcSolution: Don't use sudo with npm! The script sets up a user-local prefix.
# If you accidentally used sudo, fix permissions:
sudo chown -R $USER:$USER ~/.npm-globalSolution: The script installs Node.js 22.x. If you have an older version:
# Remove old Node (if installed via apt)
sudo apt remove nodejs
# Re-run the script
./install-ai-cli.shSolution: Verify the key format and permissions.
# Test OpenAI key
curl https://api.openai.com/v1/models \
-H "Authorization: Bearer $OPENAI_API_KEY"
# Test Anthropic key
curl https://api.anthropic.com/v1/models \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01"Solution: Check your internet connection and try again. The script is idempotent (safe to re-run).
# Update all at once
npm update -g @openai/codex @anthropic-ai/claude-code @google/gemini-cli
# Or individually
npm update -g @openai/codex
npm update -g @anthropic-ai/claude-code
npm update -g @google/gemini-cli# Remove CLIs
npm uninstall -g @openai/codex @anthropic-ai/claude-code @google/gemini-cli
# Remove Node.js (if desired)
sudo apt remove nodejs
# Clean up npm cache
rm -rf ~/.npm-global# Compare responses
codex "Explain event loops" > openai-response.txt
claude "Explain event loops" > claude-response.txt
gemini "Explain event loops" > gemini-response.txt
# Use diff to compare
diff openai-response.txt claude-response.txt#!/bin/bash
# Generate documentation for all Python files
for file in *.py; do
echo "Documenting $file..."
claude "Generate docstrings for this Python file" < "$file" > "${file}.docs.md"
done# Provide context from files
cat mycode.js | codex "Refactor this for better performance"
# Multi-turn conversations
claude chat < conversation-history.txt- Set default models early to avoid specifying them each time
- Use environment files (
.env) for projects with different API keys - Alias common commands in your shell RC for faster access
- Pipe outputs to files for later review
- Combine CLIs - use different models for different tasks
install-ai-cli.sh- Main installation scriptinstall-claude-cli-sh- (If standalone Claude installer exists)
Found an issue or want to improve the script? PRs welcome!
Part of the Modular Misfits Scripts Collection