Define and manage complex tmux sessions with YAML configuration files
Like Docker Compose, but for tmux sessions 🐳 ➡️ 🖥️
- 📝 YAML Configuration - Define your tmux sessions declaratively
- 🪟 Multi-Window Support - Create multiple windows per session
- 🔀 Pane Management - Split windows into multiple panes with custom layouts
- ⚙️ tmux Config Aware - Respects your
base-index
andpane-base-index
settings - 🎯 Simple Commands - Docker Compose-like interface (
up
,down
,ls
) - 🔄 Session Management - Start, stop, and list sessions effortlessly
- tmux - Terminal multiplexer
- yq - YAML processor
sudo pacman -S tmux yq
sudo apt install tmux
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
sudo chmod +x /usr/local/bin/yq
brew install tmux yq
-
Clone or download the script:
curl -O https://raw.githubusercontent.com/your-username/tmux-compose/main/tmux-compose.sh chmod +x tmux-compose.sh
-
Create a
tmux-compose.yml
file:version: '1' sessions: - name: development windows: - name: editor command: nvim - name: server command: npm run dev
-
Start your sessions:
./tmux-compose.sh up
version: '1'
sessions:
- name: session-name
windows:
- name: window-name
command: command-to-run
panes:
- command: pane-command
split: vertical|horizontal
layout: layout-name
version: '1'
sessions:
- name: web-development
windows:
- name: editor
command: code .
- name: frontend
command: cd frontend
panes:
- command: npm run dev
- command: npm run test:watch
split: vertical
- command: npm run lint:watch
split: horizontal
layout: main-vertical
- name: backend
command: cd backend
panes:
- command: python manage.py runserver
- command: python manage.py shell
split: horizontal
- command: tail -f logs/app.log
split: vertical
layout: even-horizontal
- name: database
panes:
- command: psql -d myapp
- command: redis-cli
split: horizontal
- name: monitoring
windows:
- name: system
command: htop
- name: logs
command: tail -f /var/log/syslog
Option | Description | Values |
---|---|---|
version |
Configuration version | '1' |
name |
Session/window name | String |
command |
Command to execute | Shell command |
split |
Pane split direction | vertical , horizontal |
layout |
tmux layout | even-horizontal , even-vertical , main-horizontal , main-vertical , tiled |
# Start all sessions defined in tmux-compose.yml
./tmux-compose.sh up
# Stop all sessions
./tmux-compose.sh down
# List running sessions
./tmux-compose.sh ls
# Use custom config file
./tmux-compose.sh -f my-config.yml up
# Show help
./tmux-compose.sh --help
Perfect for setting up consistent development environments with editors, servers, databases, and monitoring tools.
Manage multiple services, logs, and monitoring dashboards in organized tmux sessions.
Create dedicated sessions for different servers, services, or maintenance tasks.
The script automatically detects and respects your tmux configuration:
- base-index - Starting index for windows (usually 0 or 1)
- pane-base-index - Starting index for panes (usually 0 or 1)
tmux-compose supports all standard tmux layouts:
even-horizontal
- Panes arranged horizontally with equal widtheven-vertical
- Panes arranged vertically with equal heightmain-horizontal
- One main pane on top, others belowmain-vertical
- One main pane on left, others on righttiled
- Panes arranged in a grid
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Test your changes with various tmux configurations
- Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by Docker Compose
- Built for the amazing tmux terminal multiplexer
- Uses yq for YAML processing
⭐ Star this repo if you find it useful!
Made with ❤️ for the terminal enthusiasts