#3930·nvm

nvm's shell hook adds ~250ms to every new zsh shell startup

Author: hridhinvarkeyjosephCreated Sep 23, 2026Updated Sep 28, 2026
Labelspull request wantedperformance

Operating system and version:

macOS 27.0 (build 26A428), arm64 (Apple Silicon)

nvm debug output:

bash
nvm --version: v0.40.8
$TERM_PROGRAM: Apple_Terminal
$SHELL: /bin/zsh
$SHLVL: 1
whoami: 'hridhinvarkeyjoseph'
${HOME}: /Users/hridhinvarkeyjoseph
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: ${NVM_DIR}/versions/node/v20.20.2/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.14/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/pkg/env/global/bin:/opt/homebrew/bin
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'zsh 5.9 (arm64-apple-darwin26.0)'
uname -a: 'Darwin 27.0.0 Darwin Kernel Version 27.0.0: Tue Aug 11 21:02:59 PDT 2026; root:xnu-13432.1.9~1/RELEASE_ARM64_T8142 arm64'
checksum binary: 'sha256sum'
OS version: macOS 27.0 26A428
nvm current: v20.20.2
which node: ${NVM_DIR}/versions/node/v20.20.2/bin/node
which npm: ${NVM_DIR}/versions/node/v20.20.2/bin/npm

nvm ls output:

bash
->     v24.21.0
default -> 24 (-> v24.21.0)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v24.21.0) (default)
stable -> 24.21 (-> v24.21.0) (default)
lts/* -> lts/krypton (-> v24.21.0)
lts/krypton -> v24.21.0

How did you install nvm?

Homebrew (brew install nvm)

What steps did you perform?

  1. With nvm's three lines active in ~/.zshrc (export NVM_DIR, and the two [ -s ... ] && \. ... sourcing lines), ran time zsh -i -c exit three times and noted the "total" time.
  2. Temporarily commented out those same three lines in ~/.zshrc (backed up the file first).
  3. Opened a fresh shell and ran time zsh -i -c exit three times again.
  4. Compared the two sets of results.
  5. Restored ~/.zshrc afterward.

What happened?

With nvm's hook active: 0.281s, 0.278s, 0.383s total (avg ~0.31s) With nvm's hook disabled: 0.057s, 0.057s, 0.073s total (avg ~0.062s)

That's roughly a 5x slowdown — nvm adds about 220–250ms to every new interactive shell.

What did you expect to happen?

Sourcing nvm.sh should add negligible startup time.

Is there anything in any of your profile files that modifies the PATH?

Just the standard nvm-added lines in ~/.zshrc (added by brew install nvm's setup instructions). Nothing else custom.


Searched existing issues for "zsh performance" / "slow startup" first — the closest match I found is #3410 (zsh initialization performance), tagged for this exact area but without concrete before/after numbers attached. Posting this with a reproducible measurement in case it's useful; happy to have it merged into that thread if preferred.