맥(macOS)에서의 Git 설치 및 초기설정
Git 설치는 맥 또는 윈도우 구분없이 git-scm.com 사이트에서 설치 파일을 내려받아 손쉽게 설치할 수 있다. 맥 사용자는 Homebrew를 사용해 설치할 수 있다. 또한, 맥OS는 기본적으로 git이 설치되어 있기에 다음과 같이 현재 설치된 버전을 확인한다.
Git 버전 확인
1
2% git --version
git version 2.23.0Homebrew로 Git & Git-Lfs 설치
1
2
3% brew install git git-lfs
Warning: git 2.25.1 is already installed, it's just not linked
You can use `brew link git` to link this version.위 경고 메시지는 기존 macOS용 git의 link가 이미 있어 최신 버전의 git link를 생성할 수 없다는 것이다. 따라서 다음과 같이 기존의 링크를 덮어쓰기하거나 또는, 삭제 후 새로 지정할 수 있다.
최신 버전 git link 생성
1
2
3
4
5
6
7
8
9
10
11
12% brew link git
Linking /usr/local/Cellar/git/2.25.1...
Error: Could not symlink bin/git
Target /usr/local/bin/git
already exists. You may want to remove it:
rm '/usr/local/bin/git'
To force the link and overwrite all conflicting files:
brew link --overwrite git
To list all files that would be deleted:
brew link --overwrite --dry-run git기존의 Git Link 파일을 삭제한 후 다시 링크 생성
1
2
3% rm /usr/local/bin/git
% brew link --overwrite git
Linking /usr/local/Cellar/git/2.25.1... 205 symlinks created맥의 SIP 설정으로 인해 link가 되지 않을 경우 .zshrc에 PATH를 설정한다.
1
export PATH="/usr/local/sbin:$PATH"
버전 업그레이드된 git 버전 확인
1
2% git --version
git version 2.25.1깃의 한글 메시지를 영문으로 변경
1
2
3
4
5$ echo $LANG
en_US.UTF-8
$ cd ~
$ vi .zshrcexport LANG=en_US 으로 언어변경 후 프로파일을 갱신
1
$ source .zshrc
Git 설치 후 초기 환경 설정
1
2
3
4% git config --global user.name "Lee JaeHyun"
% git config --global user.email "myleje@gmail.com"
% git config --global core.precomposeuncode true
% git config --global core.quotepath false₩(원표시)를 ` 로 설정
입력소스에 따라서 ₩ 표시를 무조건 `로 표현되도록 변경한다. 아래 경로에 해당 파일을 생성한다.
~/Library/KeyBindings/DefaultkeyBinding.dict
생성한 파일에 다음과 같이 작성한다. KeyBindings 폴더가 없는 경우는 직접 생성한다.1
2
3{
"₩" = ("insertText:", "`");
}