Enterprise-grade cross-platform automation script for updating Node.js, npm, Gemini CLI, and Google Cloud SDK on Windows, macOS, and Linux systems.
The Cross-Platform Gemini CLI Update Script is a comprehensive, production-ready automation solution that ensures your development environment is always up-to-date with the latest versions of essential tools. Built with enterprise-grade reliability, extensive logging, and cross-platform compatibility.
- π Cross-Platform Support: Windows, macOS, and Linux with automatic OS detection
- π Force Reinstall: Updates all components regardless of current installation status
- π Comprehensive Logging: Detailed logs with timestamps, error tracking, and performance metrics
- πΎ Backup System: Automatic backups before updates for rollback capability
- π‘οΈ Error Handling: Graceful failure handling with detailed error reporting
- π§ IDE Integration: Manual IDE integration support (automatic skipped due to known issue)
- π Dry Run Mode: Preview changes without executing them
- π Verbose Output: Detailed execution information for debugging
- π Version Tracking: Before/after version comparison and change tracking
gemini-cli-update/
βββ update_gemini_cli.sh # Cross-platform launcher (auto-detects OS)
βββ update_gemini_cli.ps1 # Windows PowerShell script
βββ update_gemini_cli_macos.sh # macOS/Linux Bash script (primary)
βββ update_gemini_cli_original.sh # Alternative launcher (alias)
βββ README.md # This comprehensive documentation
βββ README-CROSS-PLATFORM.md # Detailed cross-platform guide
βββ CHANGELOG.md # Version history and changes
βββ CONTRIBUTING.md # Contribution guidelines
βββ LICENSE # MIT License
βββ .gitignore # Git ignore rules
βββ docs/ # Technical documentation
βββ technical-documentation.md
βββ examples/
βββ usage-examples.md
| Feature | Windows | macOS | Linux |
|---|---|---|---|
| Package Managers | Chocolatey, Scoop | Homebrew, NVM | apt, yum, dnf |
| Node.js Installation | Chocolatey/Scoop | Homebrew/NVM | NodeSource Repository |
| Google Cloud SDK | Chocolatey | Official Installer | Official Installer |
| Shell Environment | PowerShell 5.1+ | Bash 3.2+ | Bash 3.2+ |
| Permission Model | Administrator | sudo (when needed) | sudo (when needed) |
| Platform | Minimum Version | Recommended | Notes |
|---|---|---|---|
| Windows | Windows 10 1903+ | Windows 11 | PowerShell 5.1+ included |
| macOS | macOS Sequoia 15.0+ | Latest | Bash 3.2+ included |
| Linux | Ubuntu 18.04+ | Latest LTS | Most distributions supported |
- Internet Connection: Required for downloading updates
- Appropriate Permissions: Administrator/sudo access for system-wide installations
- Package Managers: Auto-installed if missing (Chocolatey, Scoop, Homebrew, etc.)
# Clone the repository
git clone https://github.com/kitterman-t/gemini-cli-update.git
cd gemini-cli-update
# Make scripts executable (Unix systems)
chmod +x update_gemini_cli.sh update_gemini_cli_macos.sh update_gemini_cli_original.sh# Download the cross-platform launcher
curl -O https://raw.githubusercontent.com/kitterman-t/gemini-cli-update/main/update_gemini_cli.sh
# Download platform-specific scripts
curl -O https://raw.githubusercontent.com/kitterman-t/gemini-cli-update/main/update_gemini_cli.ps1
curl -O https://raw.githubusercontent.com/kitterman-t/gemini-cli-update/main/update_gemini_cli_macos.sh
curl -O https://raw.githubusercontent.com/kitterman-t/gemini-cli-update/main/update_gemini_cli_original.sh
# Make executable (Unix systems)
chmod +x update_gemini_cli.sh update_gemini_cli_macos.sh update_gemini_cli_original.shThe main script automatically detects your operating system and runs the appropriate version:
# Basic usage
./update_gemini_cli.sh
# With verbose output and dry run
./update_gemini_cli.sh --verbose --dry-run
# Show help
./update_gemini_cli.sh --help# Basic usage
.\update_gemini_cli.ps1
# With verbose output
.\update_gemini_cli.ps1 -Verbose
# Dry run (preview changes)
.\update_gemini_cli.ps1 -DryRun
# Combine options
.\update_gemini_cli.ps1 -Verbose -DryRun
# Show help
.\update_gemini_cli.ps1 -Help# Basic usage (recommended - uses launcher)
./update_gemini_cli.sh
# Direct execution of macOS/Linux script
./update_gemini_cli_macos.sh
# With verbose output
./update_gemini_cli.sh --verbose
# or
./update_gemini_cli_macos.sh --verbose
# Dry run (preview changes)
./update_gemini_cli.sh --dry-run
# or
./update_gemini_cli_macos.sh --dry-run
# Combine options
./update_gemini_cli.sh --verbose --dry-run
# Show help
./update_gemini_cli.sh --help
# or
./update_gemini_cli_macos.sh --help| Option | Windows | macOS/Linux | Description |
|---|---|---|---|
-Verbose, -v |
β | --verbose, -v |
Enable verbose output with detailed execution information |
-DryRun, -d |
β | --dry-run, -d |
Preview changes without executing them |
-Help, -h |
β | --help, -h |
Show help message and usage information |
- Node.js: Latest version via platform-specific package managers
- npm: Force reinstall to latest version globally
- Gemini CLI: Force reinstall to latest version with IDE integration
- Google Cloud SDK: Platform-specific installation and updates
- Dependencies: Google Generative AI packages and global npm packages
- Chocolatey Package Manager - Updates and upgrades all packages
- Scoop Package Manager - Updates and upgrades all packages
- Google Cloud SDK - Installs/updates via Chocolatey
- Node.js - Force reinstall via Chocolatey/Scoop
- npm - Force reinstall to latest version
- Gemini CLI - Force reinstall with IDE integration
- Dependencies - All global npm packages updated
- Homebrew Package Manager - Updates and upgrades all packages
- Google Cloud SDK - Official installer with component updates
- Node.js - Force reinstall via Homebrew/NVM
- npm - Force reinstall to latest version
- Gemini CLI - Force reinstall with IDE integration
- Dependencies - All global npm packages updated
- System Package Manager - Updates via apt/yum/dnf
- Google Cloud SDK - Official installer with component updates
- Node.js - Force reinstall via NodeSource repository
- npm - Force reinstall to latest version
- Gemini CLI - Force reinstall with IDE integration
- Dependencies - All global npm packages updated
gemini-update-logs/
βββ update_YYYYMMDD_HHMMSS.log # Main detailed log file
βββ summary_YYYYMMDD_HHMMSS.txt # Human-readable summary
βββ backups/
βββ backup_YYYYMMDD_HHMMSS.txt # Configuration backup
- Command Executions: All commands with full output (stdout/stderr)
- System Information: OS, architecture, user, paths
- Version Changes: Before β after for each component
- Error Messages: Warnings, errors, and success confirmations
- File Operations: Path references and file operations
- Timing Information: Performance metrics for each operation
- API Test Results: Gemini CLI functionality verification
- Backup Information: Creation and restoration details
The script automatically detects and uses:
$HOME/$env:USERPROFILE- User home directory$PATH/$env:PATH- System PATH for command execution$SHELL/$env:COMSPEC- Current shell environment
- Log Directory: Modify
$LogDir/LOG_DIRvariables - Backup Retention: Adjust cleanup policies
- Package Managers: Add additional package managers
- Error Handling: Customize error recovery behavior
# Unix systems
chmod +x update_gemini_cli.sh update_gemini_cli_macos.sh update_gemini_cli_original.sh
# Windows PowerShell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserWindows - Chocolatey:
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))Windows - Scoop:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
irm get.scoop.sh | iexmacOS - Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Linux - Package Managers:
# Ubuntu/Debian
sudo apt update && sudo apt upgrade
# CentOS/RHEL
sudo yum update
# Fedora
sudo dnf update# Clear npm cache
npm cache clean --force
# Reset npm registry
npm config set registry https://registry.npmjs.org/IDE Integration Hanging Issue:
The script skips automatic IDE integration configuration as the gemini /ide enable command may hang due to recent configuration format changes. To manually enable IDE integration:
# Manually enable IDE integration
gemini /ide enable
# Check IDE status
gemini /ide status
# For configuration details, visit:
# https://geminicli.com/docs/get-started/configuration/Other Gemini CLI Issues:
# Check API key configuration
gemini config
# Verify internet connectivity
ping google.com
# Check for graceful errors
gemini ask "test"
# View error reports
ls /var/folders/*/gemini-client-error-*.json# Install Google Cloud SDK
curl https://sdk.cloud.google.com | bash
# Authenticate
gcloud auth login
# Set project
gcloud config set project YOUR_PROJECT_ID
# Check components
gcloud components list- Windows: 3-6 minutes (depending on package manager)
- macOS: 2-5 minutes (Homebrew optimized)
- Linux: 3-7 minutes (depending on distribution)
- Disk Space: ~200MB for logs, backups, and temporary files
- Memory: <100MB during execution
- Network: ~300MB downloads (varies by platform)
- CPU: Low usage, mostly I/O bound
- No Sensitive Data Logging: API keys, passwords excluded
- Secure Defaults: Conservative security settings
- Audit Trail: All operations logged for security review
- Backup Security: Configuration data only
- User Permissions: Respects system security
- Administrator/sudo Usage: Minimal, only when required
- File Permissions: Maintains system security
- Network Security: HTTPS for all downloads
- β Successfully updated Gemini CLI to v0.21.1 and npm to v11.7.0
- β Refined IDE integration skip message with connection error details
- β Updated documentation with current production tool versions
- β Stability verified after multiple full production update runs
- β Enhanced documentation with comprehensive function comments and usage guides
- β Improved script headers with detailed purpose, capabilities, and usage information
- β Updated all documentation files with current information and best practices
- β Version consistency across all scripts and documentation
- β Production tested and verified across multiple execution runs
- β Enhanced error handling with proper unbound variable handling
- β Improved path resolution in launcher scripts for better portability
- β Fixed launcher script recursion bug in update_gemini_cli_original.sh
- β Cross-platform support for Windows, macOS, and Linux
- β PowerShell script for Windows with Chocolatey/Scoop support
- β Enhanced Bash script for macOS/Linux with improved package management
- β Automatic OS detection and platform-specific execution
- β Comprehensive logging across all platforms
- β Force reinstall capabilities for all components
- β Enhanced error handling and recovery mechanisms
- β Enhanced force reinstall capabilities for macOS
- β Automatic Homebrew installation if not present
- β Added Google Cloud SDK installation if not present
- β Improved Node.js installation with NVM fallback
- β Fixed path issues for portable script execution
- β Enhanced Google Cloud SDK components update
- β Improved error handling and logging
- β Added Google Generative AI dependency installation
- β Enhanced IDE integration for Cursor support
- β Fixed import errors and path issues
- β Complete rewrite with enhanced logging
- β Added comprehensive backup system
- β Implemented error handling and reporting
- β Created detailed documentation
- β Initial version with basic update functionality
We welcome contributions! Please see our Contributing Guidelines for details.
# Clone the repository
git clone https://github.com/kitterman-t/gemini-cli-update.git
cd gemini-cli-update
# Test on your platform
./update_gemini_cli.sh --dry-run --verbose- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature-name - Make your changes following our coding standards
- Test thoroughly on your platform
- Commit your changes:
git commit -m "feat: add your feature description" - Push to your fork:
git push origin feature/your-feature-name - Create a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions:
- Check the logs: Review the generated log files for detailed error information
- Run in verbose mode: Use
-Verbose(Windows) or--verbose(macOS/Linux) flag - Try dry run: Use
-DryRun(Windows) or--dry-run(macOS/Linux) to preview changes - Create an issue: Open an issue on GitHub with detailed information
- Check documentation: Review the comprehensive guides in the
docs/directory
- Google: For the Gemini CLI and Google Cloud SDK
- Node.js Foundation: For Node.js and npm
- Microsoft: For PowerShell and Windows support
- Homebrew: For the macOS package manager
- Chocolatey/Scoop: For Windows package management
- Community: For feedback and contributions
- Cross-Platform Guide: Detailed cross-platform documentation
- Technical Documentation: Architecture and implementation details
- Usage Examples: Practical usage scenarios
- Contributing Guidelines: How to contribute to the project
- Changelog: Complete version history
- Production Readiness Report: Comprehensive security and readiness audit
# Run update (recommended)
./update_gemini_cli.sh
# Preview changes first
./update_gemini_cli.sh --dry-run --verbose
# Check current versions
node --version && npm --version && gemini --versionupdate_gemini_cli.sh- Primary launcher (use this)update_gemini_cli_macos.sh- macOS/Linux implementationupdate_gemini_cli.ps1- Windows PowerShell implementationupdate_gemini_cli_original.sh- Alternative launcher (same as primary)
All logs are stored in: ./gemini-update-logs/
update_*.log- Detailed execution logssummary_*.txt- Human-readable summariesbackups/*.txt- Configuration backups
Made with β€οΈ for the cross-platform developer community
Enterprise-grade automation for modern development environments