How to find delay when launching new Terminal (iTerm)

bashitermterminal

When I press CMD+N in iTerm2 to bring up a new iTerm window, sometimes it takes 10 seconds before I get my prompt. If I immediately repeat the process, the whole thing takes 1 second. To me this implies it is a slow read of a file that is then cached in memory. I put a timing statement in my .bash_profile and that takes about one second, so it is not something I have manually and intentionally done to slow it down.

How should I find out where the time is spent during the shell/terminal initiation?

I tried running sudo fs_usage -f filesys > fsusage.txt and then searching for login and bash and iTerm in the resulting file, but have not been able to determine what might cause the delay there.

Best Answer

I had the same problem and I fixed updating the setting in: Profile/General

The option Command:

Instead Login shell you can pick the option command and write your shell path. In my case zsh: /bin/zsh

You can reveal this doing: which -a bash or which -a zsh in my case