Speed up zsh startup time

Terminal startup became noticeably slow. It took like 1-2 seconds for prompt to show up.

This is for zsh users.

  • Profiling zsh scripts


# Add below on top of the .zshrc zmodload zsh/zprof
# Run profiler ❯ zprof
  • You can see what's being run by running below line

/bin/zsh -i -x
  • Check the time it takes to run zsh scripts

/usr/bin/time -p /bin/zsh -i -c exit

In my case, nvm (Node Version Manager) was the culprit. Commenting out nvm related scripts from .zshrc fixed the issue (not the best solution).

Search showed different tactics to speed up on the stackoverflow. However, none of them made any difference in my case.