context:
I used some of the other answers here, but they didn't actually fix it for me, as initially I didn't realize it only is slow for the first startup per restart. Following on the comment relating the problem to nvm
, I came across an nvm GitHub issue regarding this problem. Their solution which works for me across restarts is:
OK! So it appears adding this line to ~/.zshrc above the nvm lines works around the problem for now:
alias manpath=false
solution (workaround):
Add the alias manpath=false
line before sourcing nvm.sh
in ~/.zshrc
:
alias manpath=false
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
Now restart (or however you wish to trigger the ~/.zshrc
file being resourced).
notes:
This agrees with the fact that it happens per restart, i.e., per ~/.zshrc
execution. Also, for me I also have a non-system default for nvm, which corresponds to freedev's answer, but I need a v19+ default node version for isomorphic webcrypto, so that answer isn't acceptable.
You can read through the nvm GitHub issue for a more in depth analysis. I would recommend giving the issue a thumbs up, because the rep from nvm seemed to be incredulous that it was not a localized issue to that issue's OP. But this question has been upvoted 35 times, which clearly shows this is not the case.