-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
Update README.md #2817
base: master
Are you sure you want to change the base?
Update README.md #2817
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,24 +88,46 @@ nvm is a version manager for [node.js](https://nodejs.org/en/), designed to be i | |
<a id="install-script"></a> | ||
## Installing and Updating | ||
|
||
### Install & Update Script | ||
### Install NVM on macOS | ||
Change the ownership of these directories to your user | ||
```sh | ||
sudo chown -R $(whoami) /usr/local/share/zsh /usr/local/share/zsh/site-functions | ||
``` | ||
|
||
To **install** or **update** nvm, you should run the [install script][2]. To do that, you may either download and run the script manually, or use the following cURL or Wget command: | ||
Make sure that user has write permission | ||
```sh | ||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash | ||
chmod u+w /usr/local/share/zsh /usr/local/share/zsh/site-functions | ||
``` | ||
|
||
Use Humebrew to install NVM | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nobody should EVER use homebrew to install nvm; homebrew-installed nvm is 100% unsupported and discouraged. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for me using macbook pro m1 it's the only way nvm work :( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That shouldn’t be the case; node itself only supports m1 outside of Rosetta on v16+, but nvm itself should work fine. |
||
```sh | ||
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash | ||
brew install nvm | ||
``` | ||
|
||
Running either of the above commands downloads a script and runs it. The script clones the nvm repository to `~/.nvm`, and attempts to add the source lines from the snippet below to the correct profile file (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`). | ||
Create a director for NVM in home | ||
```sh | ||
mkdir ~/.nvm | ||
``` | ||
|
||
<a id="profile_snippet"></a> | ||
Configure Required Environment Variable | ||
```sh | ||
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" | ||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | ||
vim ~/.bash_profile | ||
``` | ||
|
||
Add the following lines to ~/.bash_profile | ||
```sh | ||
export NVM_DIR=~/.nvm | ||
source $(brew --prefix nvm)/nvm.sh | ||
``` | ||
Press ESC +:wq to save and close the file. | ||
|
||
Load the variable to the current shell environment | ||
```sh | ||
source ~/.bash_profile | ||
``` | ||
|
||
Running either of the above commands downloads a script and runs it. The script clones the nvm repository to `~/.nvm`, and attempts to add the source lines from the snippet below to the correct profile file (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`). | ||
|
||
#### Additional Notes | ||
|
||
- If the environment variable `$XDG_CONFIG_HOME` is present, it will place the `nvm` files there.</sub> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
most nvm users don't use zsh.