Home  >  Article  >  Web Front-end  >  nvm install mac

nvm install mac

DDD
DDDOriginal
2024-08-15 15:26:181007browse

This article provides step-by-step instructions on installing and setting up Node Version Manager (NVM) on macOS. NVM allows users to manage multiple Node.js versions and easily switch between them. The article covers how to install NVM, add it to th

nvm install mac

How Do I Install Node Version Manager (NVM) on macOS?

  • To install NVM on macOS, follow these steps:

    • Open Terminal (Applications -> Utilities -> Terminal).
    • Run the following command:
<code>curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash</code>
  • Once the installation is complete, close and reopen Terminal to start using NVM.

What Are the Steps to Set Up NVM on a Mac Device?

  • To set up NVM on a Mac device:

    • Install NVM using the instructions provided in the previous question.
    • Run the following command to initialize NVM:
<code>nvm init</code>
  • Add the following lines to your ~/.zshrc or ~/.bash_profile file:
<code>export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm</code>
  • Save and close the file. Reload your terminal session by running:
<code>source ~/.zshrc  #or source ~/.bash_profile</code>

Can I Install Multiple Node.js Versions Simultaneously Using NVM on My Mac?

  • Yes, you can install multiple Node.js versions simultaneously using NVM on your Mac. To do this:

    • Run the following command to list available Node.js versions:
<code>nvm ls-remote</code>
  • Select the desired Node.js version to install. For example:
<code>nvm install 16.14.2</code>
  • To switch between installed Node.js versions, run:
<code>nvm use 16.14.2</code>
  • Repeat steps 2 and 3 to install additional Node.js versions.

The above is the detailed content of nvm install mac. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn