Skip to content

Instantly share code, notes, and snippets.

@huozhi
Created January 12, 2025 14:22
Show Gist options
  • Save huozhi/5a2f2e9e74c76f3696342e59208a414c to your computer and use it in GitHub Desktop.
Save huozhi/5a2f2e9e74c76f3696342e59208a414c to your computer and use it in GitHub Desktop.
Enable tmux in iterm2 only and not in other terminals
# Check if running in iTerm2 and `tmux` is available
if [[ "$TERM_PROGRAM" == "iTerm.app" ]] && command -v tmux &>/dev/null; then
# Start a new tmux session or attach to an existing one
if [[ -z "$TMUX" ]]; then
tmux attach || tmux new
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment