From 909652aa809e910bcad8d6e54d2a6357a1092e2c Mon Sep 17 00:00:00 2001 From: Gal Schlezinger Date: Thu, 26 Nov 2020 16:51:46 +0200 Subject: [PATCH] Update installation instructions (#341) --- README.md | 87 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 56 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index b89920e..0e71051 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Example: curl -fsSL https://fnm.vercel.app/install | bash -s -- --install-dir "./.fnm" --skip-shell ``` -### Manually (OSX/Linux/Windows) +### Manually #### Using Homebrew (OSX) @@ -64,13 +64,23 @@ curl -fsSL https://fnm.vercel.app/install | bash -s -- --install-dir "./.fnm" -- brew install fnm ``` +Then, [set up your shell for fnm](#shell-setup) + #### Using Scoop (Windows) ```bash scoop install fnm ``` -Then apply the changes the installer prints, to set up your shell profile. +Then, [set up your shell for fnm](#shell-setup) + +#### Using Cargo (Linux/Mac/Windows) + +```bash +cargo install fnm +``` + +Then, [set up your shell for fnm](#shell-setup) #### Using a release binary (Linux/Mac/Windows) @@ -78,55 +88,70 @@ Then apply the changes the installer prints, to set up your shell profile. - Make it available globally on `PATH` environment variable - Configure your shell profile: - - For **Bash** or **Zsh** users, add the following to your `.bashrc`/`.zshrc` respectively: +## Completions - ```bash - eval "$(fnm env)" - ``` +fnm ships its completions with the binary: - - For [**Fish Shell**](https://fishshell.com/) users, create `~/.config/fish/conf.d/fnm.fish` add this line to it: +``` +fnm completions --shell +``` - ```fish - fnm env | source - ``` +Where `` can be one of the supported shells: - - For **PowerShell** users, add the following to the end of your profile file:: +- `bash` +- `zsh` +- `fish` +- `powershell` - ```powershell - fnm env --use-on-cd | Out-String | Invoke-Expression - ``` +Please follow your shell instructions to install them. - - On Windows, the profile is located at `~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1` - - For Mac/Linux, the profile is located at `~/.config/powershell/Microsoft.PowerShell_profile.ps1` +### Shell Setup - - For **WinCMD**, aka good old **Windows Command Prompt** or **Batch**, fnm is also supported but is not entirely covered. [You can set up a startup script](https://superuser.com/a/144348) and append the following line: +fnm needs to run some shell commands before you can start using it. +This is done by evaluating the output of `fnm env`. Check out the following guides for the shell you use: - ``` - FOR /f "tokens=*" %i IN ('fnm env --use-on-cd') DO CALL %i - ``` +#### Bash -#### Using Cargo (Linux/Mac/Windows) +add the following to your `.bashrc` profile: ```bash -cargo install fnm +eval "$(fnm env)" ``` -## Completions +#### Zsh -fnm ships its completions with the binary: +add the following to your `.zshrc` profile: +```zsh +eval "$(fnm env)" ``` -fnm completions --shell + +#### Fish shell + +create `~/.config/fish/conf.d/fnm.fish` add this line to it: + +```fish +fnm env | source ``` -Where `` can be one of the supported shells: +#### PowerShell -- `bash` -- `zsh` -- `fish` -- `powershell` +add the following to the end of your profile file:: -Please follow your shell instructions to install them. +```powershell +fnm env --use-on-cd | Out-String | Invoke-Expression +``` + +- On Windows, the profile is located at `~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1` +- For Mac/Linux, the profile is located at `~/.config/powershell/Microsoft.PowerShell_profile.ps1` + +#### Windows Command Prompt aka Batch aka WinCMD + +fnm is also supported but is not entirely covered. [You can set up a startup script](https://superuser.com/a/144348) and append the following line: + +``` +FOR /f "tokens=*" %i IN ('fnm env --use-on-cd') DO CALL %i +``` ## Usage