Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Zsh start time issues.

On 2010-12-30 at 16:48 +0300, Yuriy Taraday wrote:
> Hello.
> I've recently started using zsh as my default shell. The first bugging thing
> is that it takes really long to start zsh. On MacOS X it takes about 6
> seconds to start. When connecting to my FreeBSD server (where I set zsh as
> my default shell too) it takes about 35 seconds to see shell prompt.
> On FreeBSD I have clean install from ports, on MacOS I set up zsh-templates.
> Are there any way to find out what's taking so much time?

35 seconds sounds like there's a 30 second DNS timeout involved, from
sshd, before zsh is even involved.  sshd_config "UseDNS no" if there's
no reverse DNS for your source IP, to keep sshd from stalling while it
tries to figure out who you are?

The first file read by zsh is /etc/zshenv (or some variant thereof,
depending upon install options).  The second is ~/.zshenv.

My ~/.zshenv starts with:
----------------------------8< cut here >8------------------------------
[[ -n $TRACE_ZSH_PROF ]] && zmodload -i zsh/zprof
[[ -n $TRACE_ZSH_TIME ]] && PS4='+[%D{%M:%S}]%N:%i> '
if [[ -n $TRACE_ZSH ]]; then
        [[ -n "$TRACE_ZSH_FILE" ]] && exec 2> "${TRACE_ZSH_FILE}"
        setopt xtrace
----------------------------8< cut here >8------------------------------

You can then modify /etc/ssh/sshd_config to include:
  AcceptEnv TRACE_ZSH*

You can then export some environment variables to the ssh command to get
a trace of everything that happens, from ~/.zshenv onwards.  You might
need a SendEnv in the client SSH config too.


Messages sorted by: Reverse Date, Date, Thread, Author