zsh crash when starting inside tmux with `zsh-newuser-install: startup files exist, aborting`

This happens to me when, after booting, I open the terminal inside IntelliJ before opening a standalone terminal:

  • If I open the standalone terminal first, both the standalone and IntelliJ's terminals work well.
  • If I open IntelliJ's terminal first, both the the standalone and IntelliJ's terminals fail showing this message: zsh-newuser-install: startup files exist, aborting.

The only workaround I've found to this is:

  1. Close all the terminals and open a standalone terminal, the message should not be shown, then while this one is open, open the IntelliJ terminal and the problem won't happen anymore.
  2. In some cases that hasn't worked because I opened the standalone terminal first. In that case, I do what @rghamilton3 suggests: tmux kill-server and then do #1 again.

I know this is old but I seen newer comments on it and I just had this happen to me. I just killed the server by running tmux kill-server and surprisingly enough that did fixed it for me. YMMV of course but hopefully it helps someone else.


First, the zsh-newuser-install function should only be run if:

1) The user does not have any personal zsh startup files(like .zshrc)

2) If the following lines appear in your .zshrc file:

autoload -Uz zsh-newuser-install
zsh-newuser-install -f

3) If the same commands are run manually.

I would check your .zshrc file just in case. Hopefully this will give you a place to start looking.

Personally I wouldn't put the tmux command in the first line of the .zshrc file, but that is my personal opinion. I believe using the TMUX variable is not the best choice for determining if tmux is already running. You would have to be starting a shell running in a tmux window/pane for the variable TMUX to be set. The results of tmux ls would be a better choice in my opinion.

Var=("${(f)$(tmux ls)}")
[ ${#Var} -eq 0 ] && tmux

As I don't know your use case, you may not choose this method.