Homebrew / nvm 설치

yunny·2023년 1월 22일
0

westudy

목록 보기
1/15

개발을 처음 시작할 때 Homebrew를 설치하는데 1시간이 넘게 걸렸던 기억이 있다
당장 필요하지 않지만 나중을 위해 기록

MacOS (M1)

1. homebrew package manger 설치

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

설치 과정 중 macOs 계정과 비번을 물어봄

2. 설치 완료시 뜨는 안내 메시지

==> Next steps:
- Add Homebrew to your PATH in /Users/<USER_ID>/.zprofile:
    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/<USER_ID>/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"
- Run `brew help` to get started
- Further documentation:
    https://docs.brew.sh

3. 경로 설정

 echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/<USER_ID>/.zprofile
$ eval "$(/opt/homebrew/bin/brew shellenv)"

4. 설치 확인

which brew
/opt/homebrew/bin/brew

5. 버전 확인

brew --version
Homebrew 3.1.5

NVM(Node Version Manger) Install

1. nvm 설치

brew install nvm

2. 설치 완료시 출력되는 안내메시지

Please note that upstream has asked us to make explicit managing
nvm via Homebrew is unsupported by them and you should check any
problems against the standard nvm install method prior to reporting.

You should create NVM's working directory if it doesn't exist:

  mkdir ~/.nvm

Add the following to ~/.zshrc or your desired shell
configuration file:

  export NVM_DIR="$HOME/.nvm"
  [ -s "/usr/local/opt/nvm/nvm.sh" ] && \. "/usr/local/opt/nvm/nvm.sh"  # This loads nvm
  [ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/usr/local/opt/nvm/etc/bash_completion.d/nvm"  # This loads nvm bash_completion

You can set $NVM_DIR to any location, but leaving it unchanged from
/usr/local/opt/nvm will destroy any nvm-installed Node installations
upon upgrade/reinstall.

3. 안내 메세지대로 / 위치에 .nvm 디렉토리 생성

mkdir ~/.nvm

4. ~/.zshrc 파일을 열고 설정 추가

.zshrc

export NVM_DIR="$HOME/.nvm"
  [ -s "/usr/local/opt/nvm/nvm.sh" ] && \. "/usr/local/opt/nvm/nvm.sh"  # This loads nvm
  [ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/usr/local/opt/nvm/etc/bash_completion.d/nvm"  # This loads nvm bash_completion

5. nvm 스크립트 사용하기 위해 .zshrc 파일 수정한 값 적용되도록

source ~/.zshrc

6. 설치 여부 확인

nvm --version

NVM으로 node.js LTS 버전 설치

1. 설치 가능한 노드 버전 확인 가능

nvm list-remote

2. 버전 선택하여 설치

nvm install v16.15.0

3. 설치 되어 있는 버전 확인

nvm list

4. 설치 완료 후, 원하는 버전 활성화

nvm use v16.15.0

use 안해서 헤맨 적이 있다.. 꼭 확인하기..

profile
기록하지 않으면 잊어버려요 !

0개의 댓글

관련 채용 정보