11

Every time I try to start zsh inside of tmux it crashes wwith

zsh-newuser-install:  startup files exist, aborting

It worked flawless yesterday night, and suddenly this morning nothing works...

I'm starting tmux with this line as the first in .zshrc:

if [ "$TMUX" = "" ]; then tmux; fi

Thanks!

My zshrc file: https://github.com/Richard87/oh-my-zsh/blob/master/templates/zshrc.zsh-template

EDIT

It suddenly started working again... I don't know what changed, or what is wrong... scratch that, it stopped working again

EDIT #2

On the same computer, it works for root user, but not my main user (the .zshrc files are exactly the same, the only different is that my own user have a custom tmux config file:

# set Zsh as your default Tmux shell
set-option -g default-shell /bin/zsh

# Tmux should be pretty, we need 256 color for that
set -g default-terminal "screen-256color"


# Tmux uses a 'control key', let's set it to 'Ctrl-a'
# Reason: 'Ctrl-a' is easier to reach than 'Ctrl-b'
set -g prefix C-a
unbind C-b

# command delay? We don't want that, make it short
set -sg escape-time 1

# Set the numbering of windows to go from 1 instead
# of 0 - silly programmers :|
set-option -g base-index 1
setw -g pane-base-index 1


# Allow us to reload our Tmux configuration while
# using Tmux
bind r source-file ~/.tmux.conf \; display "Reloaded!"

# Getting interesting now, we use the vertical and horizontal
# symbols to split the screen
bind | split-window -h
bind - split-window -v
6
  • Did you manage to solve this? I got the same problem today.
    – DWilches
    Commented Jun 15, 2017 at 17:01
  • Nope, not yet 😕
    – Richard87
    Commented Jun 15, 2017 at 18:48
  • How about now gus? I have the same problem today. Commented Sep 22, 2017 at 11:18
  • Just had this problem myself, any solution for you? Commented Nov 1, 2017 at 22:47
  • Sorry, the only solution I have is disabling tmux or zsh (I hose tmux)
    – Richard87
    Commented Nov 2, 2017 at 8:34

3 Answers 3

11

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.
2
  • For Intellij users running into the issue described above, here's the solution: stackoverflow.com/a/46696447/559119
    – Sun
    Commented Apr 12, 2018 at 22:41
  • Yes this works, and all started because I tried to use a terminal plugin in sublime. Closing all open terminals and reopening fixed everything
    – smac89
    Commented Aug 14, 2018 at 16:45
5

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.

1

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.

1
  • This does not solve my problem, since there are no lines like yours in my zshrc file :/
    – Richard87
    Commented Jun 28, 2017 at 10:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .