mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-06-27 11:38:43 +00:00
Update README.md
This commit is contained in:
parent
ef3b20c21e
commit
f4da02f3de
44
README.md
44
README.md
@ -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>
|
<a id="install-script"></a>
|
||||||
## Installing and Updating
|
## Installing and Updating
|
||||||
|
|
||||||
### Install & Update Script
|
### Install NVM on macOS
|
||||||
|
Change the ownership of these directories to your user
|
||||||
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:
|
|
||||||
```sh
|
```sh
|
||||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
|
sudo chown -R $(whoami) /usr/local/share/zsh /usr/local/share/zsh/site-functions
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Make sure that user has write permission
|
||||||
```sh
|
```sh
|
||||||
wget -qO- 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
|
||||||
|
```sh
|
||||||
|
brew install nvm
|
||||||
|
```
|
||||||
|
|
||||||
|
Create a director for NVM in home
|
||||||
|
```sh
|
||||||
|
mkdir ~/.nvm
|
||||||
|
```
|
||||||
|
|
||||||
|
Configure Required Environment Variable
|
||||||
|
```sh
|
||||||
|
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`).
|
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`).
|
||||||
|
|
||||||
<a id="profile_snippet"></a>
|
|
||||||
```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
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Additional Notes
|
#### Additional Notes
|
||||||
|
|
||||||
- If the environment variable `$XDG_CONFIG_HOME` is present, it will place the `nvm` files there.</sub>
|
- If the environment variable `$XDG_CONFIG_HOME` is present, it will place the `nvm` files there.</sub>
|
||||||
|
Loading…
Reference in New Issue
Block a user