dev/mac

[macOS] 개발환경 구축 - Git 연동하기

hazelbean 2025. 5. 3. 21:26

1. Homebrew 설치

1-1. Homebrew 홈페이지로 이동 (https://brew.sh/)

 

Homebrew

The Missing Package Manager for macOS (or Linux).

brew.sh

 

1-2. 메인에 있는 Homebrew 설치 명령어 복사

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

1-3. 터미널 실행 후 Homebrew 설치 명령어 붙여넣기 및 실행

 

2. Git 설치

2-1. 터미널에서 'brew install git' 입력하여 Git 설치

brew install git

2-2. 2-1 명령어 실행했을 때, 'zsh: command not found: brew' 메시지 발생할 경우 eval 명령어로 brew 실행

eval $(/opt/homebrew/bin/brew shellenv)

 

2-3. 'brew help' 입력하여 brew 설치 확인

brew help                              
    Example usage:
      brew search TEXT|/REGEX/
      brew info [FORMULA|CASK...]
      brew install FORMULA|CASK...
      brew update
      brew upgrade [FORMULA|CASK...]
      brew uninstall FORMULA|CASK...
      brew list [FORMULA|CASK...]

    Troubleshooting:
      brew config
      brew doctor
      brew install --verbose --debug FORMULA|CASK

    Contributing:
      brew create URL [--no-fetch]
      brew edit [FORMULA|CASK...]

    Further help:
      brew commands
      brew help [COMMAND]
      man brew
      https://docs.brew.sh

2-4. 터미널에서 'brew install git' 입력하여 Git 설치

brew install git
    ==> Downloading https://ghcr.io/v2/homebrew/core/git/manifests/2.49.0
    ######################################################################################################################### 100.0%
    ==> Fetching dependencies for git: libunistring, gettext and pcre2
    ==> Downloading https://ghcr.io/v2/homebrew/core/libunistring/manifests/1.3
    ######################################################################################################################### 100.0%
    ==> Fetching libunistring
    ==> Downloading https://ghcr.io/v2/homebrew/core/libunistring/blobs/sha256:3cd26bae2d5fcf61294f14c18e5e7ec773a59ed1bf710fb92055e
    ######################################################################################################################### 100.0%
    ==> Downloading https://ghcr.io/v2/homebrew/core/gettext/manifests/0.24
    ######################################################################################################################### 100.0%
    ==> Fetching gettext
    ==> Downloading https://ghcr.io/v2/homebrew/core/gettext/blobs/sha256:be3555b4d0ed00fd50720e3f467cf9ca91fe0645ba29ba206f6bff2763
    ######################################################################################################################### 100.0%
    ==> Downloading https://ghcr.io/v2/homebrew/core/pcre2/manifests/10.45
    ######################################################################################################################### 100.0%
    ==> Fetching pcre2
    ==> Downloading https://ghcr.io/v2/homebrew/core/pcre2/blobs/sha256:f2abc87de6796a4e639f93d42c6d515cad90418fd7b701bcf322fb8e1443
    ######################################################################################################################### 100.0%
    ==> Fetching git
    ==> Downloading https://ghcr.io/v2/homebrew/core/git/blobs/sha256:83df6cf802d005d34f131e88c8eea50c8ec6d8b9423953bde99ccfcdd1d537
    ######################################################################################################################### 100.0%
    ==> Installing dependencies for git: libunistring, gettext and pcre2
    ==> Installing git dependency: libunistring
    ==> Downloading https://ghcr.io/v2/homebrew/core/libunistring/manifests/1.3
    Already downloaded: /Users/dk/Library/Caches/Homebrew/downloads/a570da63bc1839c7e217f203abd54d4d873ebd6b99f6e88994d0e79e2ebe987c--libunistring-1.3.bottle_manifest.json
    ==> Pouring libunistring--1.3.arm64_sequoia.bottle.tar.gz
    🍺  /opt/homebrew/Cellar/libunistring/1.3: 59 files, 5.4MB
    ==> Installing git dependency: gettext
    ==> Downloading https://ghcr.io/v2/homebrew/core/gettext/manifests/0.24
    Already downloaded: /Users/dk/Library/Caches/Homebrew/downloads/8abb4a73a097ce307663b52d2da2d1d9b10df035244eb566425042eee157d0b3--gettext-0.24.bottle_manifest.json
    ==> Pouring gettext--0.24.arm64_sequoia.bottle.tar.gz
    🍺  /opt/homebrew/Cellar/gettext/0.24: 2,189 files, 19.9MB
    ==> Installing git dependency: pcre2
    ==> Downloading https://ghcr.io/v2/homebrew/core/pcre2/manifests/10.45
    Already downloaded: /Users/dk/Library/Caches/Homebrew/downloads/bbac938545583185faba88567f1a952d7cc0b825820a2980533f7b3550dc31ad--pcre2-10.45.bottle_manifest.json
    ==> Pouring pcre2--10.45.arm64_sequoia.bottle.tar.gz
    🍺  /opt/homebrew/Cellar/pcre2/10.45: 242 files, 6.7MB
    ==> Installing git
    ==> Pouring git--2.49.0.arm64_sequoia.bottle.tar.gz
    ==> Caveats
    The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.
    Subversion interoperability (git-svn) is now in the `git-svn` formula.

    zsh completions and functions have been installed to:
      /opt/homebrew/share/zsh/site-functions
    ==> Summary
    🍺  /opt/homebrew/Cellar/git/2.49.0: 1,731 files, 55.1MB
    ==> Running `brew cleanup git`...
    Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
    Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
    ==> Caveats
    ==> git
    The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.
    Subversion interoperability (git-svn) is now in the `git-svn` formula.

    zsh completions and functions have been installed to:
      /opt/homebrew/share/zsh/site-functions

2-5. 터미널에서 'git --version' 실행하여 Git 설치 확인

 git --version
 	git version 2.39.5 (Apple Git-154)

2-6. git conifg 사용자 설정

git config --global user.name "username"
git config --global user.email "useremail@mail.com"

2-7. git config 설정 확인

git config --list
	credential.helper=osxkeychain
	init.defaultbranch=main
	user.name=username
	user.email=usermail@mail.com