fnm icon indicating copy to clipboard operation
fnm copied to clipboard

feat(install): fix setup_shell function for brew users

Open better-salmon opened this issue 8 months ago • 3 comments

Fixing the install script for brew users

Issue

When installing fnm via Homebrew, the binary gets installed to Homebrew's directory structure rather than the default INSTALL_DIR. Additionally, Homebrew automatically adds fnm to the PATH, making our manual PATH manipulation unnecessary and potentially problematic.

Changes

  • Set a USE_HOMEBREW flag to false by default
  • Updated shell configuration for all supported shells (zsh, fish, bash) to handle Homebrew installations differently:
    • For Homebrew installations: only add eval "$(fnm env)" to shell config files
    • For direct installations: maintain existing behavior with PATH manipulation
  • Simplify shell configuration when Homebrew is used, avoiding redundant PATH modifications

These changes ensure fnm works correctly regardless of installation method, while respecting the environment setup performed by package managers.

Fix #824 #1190 #1194 #1237 #1279 #1376

better-salmon avatar Apr 24 '25 11:04 better-salmon

⚠️ No Changeset found

Latest commit: 2e5d41180dcaa898b6d9eca7ddbaaab557d3bcf9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Apr 24 '25 11:04 changeset-bot[bot]

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fnm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 28, 2025 6:52am

vercel[bot] avatar Apr 24 '25 11:04 vercel[bot]

👋 @Schniz looks like this PR and https://github.com/Schniz/fnm/pull/1362 both attempt to fix this issue, do you think one of them could be merged soon? Fresh installs following the instructions at https://nodejs.org/en/download still seem to fail on MacOS due to these bugs.

polybuildr avatar Apr 27 '25 08:04 polybuildr