can't get ghostty to open tmux on launch

Hey just installed ghostty and I freakin' love it BUT i can't get it to launch tmux on launch. from my understanding if I have tmux installed threw brew... which I did. but for some reason it doesn't auto launch. i've tried looking up the config add in to make it work but I can't find anything... any help would be great
Solution:
try running the exact executable of tmux: command=/usr/bin/tmux
Jump to solution
7 Replies
xyzmani
xyzmani2w ago
add this line in the config:
command=tmux
command=tmux
Dallas
DallasOP2w ago
thanks for the response! i get an error saying that terminal failed to launch the command... do i need to give extra permissions? if so how..... the thing that's confusing is that that launching
tmux
tmux
directly in terminal works, but the autolaunch doesn't
Ghostty failed to launch the requested command:

/usr/bin/login -flp appledododo /bin/bash --noprofile --norc -c exec -l tmux

Runtime: 46 ms

Press any key to close the window.
Ghostty failed to launch the requested command:

/usr/bin/login -flp appledododo /bin/bash --noprofile --norc -c exec -l tmux

Runtime: 46 ms

Press any key to close the window.
is the error i receive
Solution
xyzmani
xyzmani2w ago
try running the exact executable of tmux: command=/usr/bin/tmux
xyzmani
xyzmani2w ago
not sure if the location is similar for macOS, I am on Linux.
Dallas
DallasOP2w ago
i'll look it up but the error just looks like it needs the directory
xyzmani
xyzmani2w ago
just for anyone who followed this, don't just use command=tmux to open tmux on ghostty startup it will create a new session everytime you open ghostty even if there is a session running already use a script like this and run this on startup:
#!/bin/bash

SESSION_NAME="ghostty"

# Check if the session already exists
tmux has-session -t $SESSION_NAME 2>/dev/null

if [ $? -eq 0 ]; then
# If the session exists, reattach to it
tmux attach-session -t $SESSION_NAME
else
# If the session doesn't exist, start a new one
tmux new-session -s $SESSION_NAME -d
tmux attach-session -t $SESSION_NAME
fi
#!/bin/bash

SESSION_NAME="ghostty"

# Check if the session already exists
tmux has-session -t $SESSION_NAME 2>/dev/null

if [ $? -eq 0 ]; then
# If the session exists, reattach to it
tmux attach-session -t $SESSION_NAME
else
# If the session doesn't exist, start a new one
tmux new-session -s $SESSION_NAME -d
tmux attach-session -t $SESSION_NAME
fi
matt.ts
matt.ts2w ago
I would suggest to use zsh tmux plugin it takes complete care of tmux starting managing sessions and everything using basic configuration. If you want to see how I use it you can check my dot files
GitHub
ohmyzsh/plugins/tmux/README.md at master · ohmyzsh/ohmyzsh
🙃 A delightful community-driven (with 2,400+ contributors) framework for managing your zsh configuration. Includes 300+ optional plugins (rails, git, macOS, hub, docker, homebrew, node, php, pyth...
GitHub
GitHub - mattsivak/dotfiles: All of my configs, that i use with stow.
All of my configs, that i use with stow. Contribute to mattsivak/dotfiles development by creating an account on GitHub.

Did you find this page helpful?