Home > Web Front-end > JS Tutorial > body text

nvm install mac

DDD
Release: 2024-08-15 15:26:18
Original
977 people have browsed it

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>
Copy after login
  • 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>
Copy after login
  • 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>
Copy after login
  • Save and close the file. Reload your terminal session by running:
<code>source ~/.zshrc  #or source ~/.bash_profile</code>
Copy after login

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>
Copy after login
  • Select the desired Node.js version to install. For example:
<code>nvm install 16.14.2</code>
Copy after login
  • To switch between installed Node.js versions, run:
<code>nvm use 16.14.2</code>
Copy after login
  • 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!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!