Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing fnm on macOS using recommended script & Brew sets incorrect path #1376

Open
Mathias-S opened this issue Feb 4, 2025 · 2 comments

Comments

@Mathias-S
Copy link

Mathias-S commented Feb 4, 2025

The fnm installation doesn't work on macOS when using the recommended script to install fnm (which uses Homebrew):

curl -fsSL https://fnm.vercel.app/install | bash

The script installs fnm to Homebrew's folder, typically /opt/homebrew/bin/fnm on macOS running ARM.

However, the installation script is hard coded to set $FNM_PATH to $HOME/Library/Application Support/fnm (which doesn't exist), so the code inserted into the shell file will have the incorrect path:

# fnm
FNM_PATH="/Users/myusername/Library/Application Support/fnm"
if [ -d "$FNM_PATH" ]; then
  export PATH="/Users/myusername/Library/Application Support/fnm:$PATH"
  eval "`fnm env`"
fi

This renders the installation broken unless the user manually corrects the path.

The README also incorrectly states that fnm is installed in that folder.

Workaround

Brew actually installs fnm correctly. If running fnm env in your terminal works, then you can update ~/.zshrc (or the corresponding shell file if you're using a different shell) and replace the aforementioned code with just the following:

eval "`fnm env`"

FNM_PATH isn't actually used by fnm, so it doesn't need to be set. Updating the PATH variable is also unnecessary if you've already verified that you can run fnm from your terminal.

@transfer1992
Copy link

I have exactly this experience on macOS right now.

@joseph-navant
Copy link

I just manually added /opt/homebrew/bin/fnm env --use-on-cd | source to my fnm.fish file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants