프로그래밍/Git
[Git] 맥북 M1 맥 OS Git 설치하기
브랜치 미정
2022. 2. 27. 23:27
Mac OS 에는 기본적으로 낮은버전의 git이 내장되어있다.
homebrew로 최신버전을 설치해보자
homebrew는 패키지 관리자 애플리케이션이다.
git도 패키지로 존재한다.
1. homebrew 설치
Homebrew 홈페이지에 들어가서
Homebrew 설치하기 아래에 있는것을 터미널에 붙여넣는다. 옆에 노트모양 아이콘을 누르면 copy 된다.
엔터를 누르고 기다리면 설치가 끝난다.
설치가 완료 되었지만 위에 Warining 문구가 뜨고 brew 명령어를 입력해도 zsh not found brew 가 나올 것 이다.
해결방법은 아래와 같다. 한줄씩 입력하자
# We'll be installing Homebrew in the /opt directory.
cd /opt
# Create a directory for Homebrew. This requires root permissions.
sudo mkdir homebrew
# Make us the owner of the directory so that we no longer require root permissions.
sudo chown -R $(whoami) /opt/homebrew
# Download and unzip Homebrew. This command can be found at https://docs.brew.sh/Installation.
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
# Add the Homebrew bin directory to the PATH. If you don't use zsh, you'll need to do this yourself.
echo "export PATH=/opt/homebrew/bin:$PATH" >> ~/.zshrc
입력한 뒤에 터미널을 껏다 키면 brew 명령어를 입력할 수 있게된다.
2. git 설치
brew install git 을 입력하여 git을 설치한다.
git 버전이 2.33.1_1 에서 2.35.1로 업그레이드 되었다고 나온다.