- 🖥 Integrated GPU Mode — force the Intel iGPU for maximum battery life on long unplugged sessions
- ⚡ Discrete GPU Mode — activate the dedicated dGPU for full graphics performance when you need it
- 🤖 Auto Mode — restore macOS default behaviour, letting the system switch GPUs dynamically
- 🎨 Interactive TUI — arrow-key picker built with Ink/React, shows your current mode at a glance
- 🔋 Headless Subcommands — scriptable
integrated|discrete|auto|statusfor shell scripts and Raycast - 🛠 Zero Config — thin wrapper around
pmset, no daemons, no background processes, no setup - 📦 Typed & Modern — strict TypeScript, ESM-only, built with tsup
- Node.js 20+
- macOS on an Intel Mac with both integrated and discrete GPU (e.g. MacBook Pro 2019 or earlier)
npm install -g @kud/gpuswitch-cli# Interactive TUI — pick a mode with arrow keys
gpuswitch
# Or go straight to a mode
gpuswitch integrated # save battery
gpuswitch discrete # full power
gpuswitch auto # let macOS decide
gpuswitch status # see what's activeSwitching GPU mode requires
sudo— you will be prompted for your password.
| Command | Description |
|---|---|
gpuswitch |
Open interactive TUI mode (↑↓ + enter) |
gpuswitch integrated |
Switch to integrated GPU only |
gpuswitch discrete |
Switch to discrete GPU only |
gpuswitch auto |
Let macOS manage GPU switching |
gpuswitch status |
Print the current GPU mode |
gpuswitch --help |
Show usage |
Project Structure
gpuswitch-cli/
├── src/
│ ├── gpu.ts ← pmset read/write logic
│ ├── app.tsx ← Ink interactive TUI
│ └── index.tsx ← entry point (headless or TUI)
├── dist/
├── package.json
├── tsconfig.json
└── eslint.config.js
Scripts
| Script | Description |
|---|---|
npm run dev |
Run from source with tsx |
npm run build |
Compile TypeScript to dist/ |
npm run build:watch |
Watch mode with auto-rebuild |
npm run typecheck |
Type-check without emitting |
npm run lint |
Run ESLint |
npm run format |
Format with Prettier |
Workflow
git clone https://github.com/kud/gpuswitch-cli.git
cd gpuswitch-cli
npm install
npm run build
node dist/index.js| Component | Details |
|---|---|
| Runtime | Node.js ≥ 20 |
| Language | TypeScript 5.x (ESM) |
| TUI | Ink 7.x + React 19 |
| Build | tsup |
| Linting | ESLint + Prettier |
| GPU control | pmset (macOS built-in) |
| Package | npm · @kud/gpuswitch-cli |
MIT © kud — Made with ❤️ for Intel Mac users
⭐ Star this repo if it saves your battery · ↑ Back to top