Install script configures .zshrc incorrectly on MacOS when using Homebrew
Using macOS 14.6.1 (23G93) on a MacBook Pro 16-inch, 2021 with an Apple M1 Pro chip.
Steps to reproduce
- Install using
curl -fsSL https://fnm.vercel.app/install | bash - Run
source /Users/esseb/.zshrcas instructed - Run
fnm use
Expected result
fnm should run without any errors.
Actual result
error: We can't find the necessary environment variables to replace the Node version.
You should setup your shell profile to evaluate `fnm env`, see https://github.com/Schniz/fnm#shell-setup on how to do this
Check out our documentation for more information: https://fnm.vercel.app
Further information
I think the bug is because setup_shell in https://fnm.vercel.app/install appends this to .zshrc:
# fnm
FNM_PATH="/Users/esseb/Library/Application Support/fnm"
if [ -d "$FNM_PATH" ]; then
export PATH="/Users/esseb/Library/Application Support/fnm:$PATH"
eval "`fnm env`"
fi
The folder that FNM_PATH refers to is never created in download_fnm when using homebrew, however, so the if statement is not true and fnm env does not get run.
https://github.com/Schniz/fnm/issues/824#issuecomment-2291882222 seems to have discovered the same issue with the incorrect FNM_PATH.
Same issue here. Fresh install under zsh on macOS 15.1.1.
Can confirm that fix you linked to (changing the path in ~/.zshrc) works. 👍🏻