Launching a complete local development stack often means opening multiple terminals, starting databases, launching backend services, and firing up front‑end dev servers—each step manual and error‑prone. This guide shows how to launch local development stack with tmuxinator using one command, turning a tedious routine into a reliable, reproducible workflow.
Why Tmuxinator Beats Manual Setup
Manually spinning up services wastes minutes each day and creates inconsistencies across team members. Tmuxinator solves this by storing a declarative layout in a YAML file that launches panes, runs commands, and sets environment variables automatically. The result is faster onboarding, fewer works-on-my-machine bugs, and a clear audit trail of what constitutes your local stack.
Installing Tmuxinator and Dependencies
- Ensure you have tmux installed (e.g.,
sudo apt install tmuxon Ubuntu orbrew install tmuxon macOS). - Install Ruby gem:
gem install tmuxinator. (If you use rbenv or asdf, make sure the gem is available in your PATH.) - Optional: add an alias for convenience, e.g.,
alias mux=tmuxinatorin your shell rc file. - Verify installation:
tmuxinator versionshould print the current release.
All steps take under two minutes on a fresh workstation and require only standard package managers.
Creating a Project‑Specific Tmuxinator Config
Create a file ~/.tmuxinator/myproject.yml with the following layout. Adjust service names and commands to match your stack.
name: myproject
root: ~/code/myproject
# Optional: pass arguments to the template
args: [dev]
windows:
- editor:
layout: main-vertical
panes:
- vim
- git status
- backend:
layout: tiled
panes:
- bundle exec rails server
- redis-server
- database:
layout: even-horizontal
panes:
- psql -U postgres -d myproject_dev
- watch -n 5 pg_stat_activity
- frontend:
layout: tiled
panes:
- npm run dev
- eslint --watch src/**
The YAML defines four windows: editor, backend, database, and frontend. Each window can hold multiple panes with custom layouts, allowing you to monitor logs, run consoles, or watch file changes side‑by‑side.
Running the One‑Command Launch: launch local development stack with tmuxinator
With the file in place, start the entire stack by executing:
mux start myproject
Tmuxinator reads the YAML, creates a tmux session named myproject, splits the panes according to the layout, and launches each command. If any pane exits, you can respawn it with tmux resize-pane -Z or simply re‑run the start command—tmuxinator will attach to the existing session.
- One command replaces dozens of manual steps.
- Consistent layout improves pair programming and screen sharing.
- Easy to version‑control the config alongside your code.
Customizing and Extending Your Workflow
You can add environment variables via exports: block, run database migrations automatically, or integrate with direnv for per‑project secrets. For example:
exports: DATABASE_URL: "postgres://localhost/myproject_dev" RAILS_ENV: "development"
Place the exports block before windows: to make them available to every pane. Combining tmuxinator with tools like entr or watchexec enables hot‑reloading without leaving the terminal.
Conclusion
Adopting a single launch local development stack with tmuxinator command transforms a fragmented startup routine into a dependable, shareable process. By codifying your layout in YAML you eliminate manual drudgery, reduce environment drift, and give every teammate instant access to the same powerful setup. Give it a try today—copy the example config, tweak the services to match your stack, and enjoy the speed gains of a one‑command launch.