MacOS - Homebrew 설치하기

2023. 3. 27. 23:36DEV/Mac

반응형

Homebrew란?

Mac에서 설치할 때 가장 유용한 Homebrew부터 설치를 해야겠죠?! 일반적인 방식으로 설치하려면 다운로드 받아서 압축 풀고 옮기고 경로 잡고... 귀찮잖아요~😮‍💨 그래서 저는 가능한 한 Homebrew로 설치하는 방법을 선호한답니다.

우선 Homebrew에 대해 간단하게 정리해 볼게요.

Homebrew는 컴퓨터에 소프트웨어를 쉽게 설치하고 관리할 수 있도록 해주는 MacOS용 패키지 관리자입니다. 패키지 설치, 업데이트 및 제거를 위한 간단한 명령줄 인터페이스를 제공하며 사용자를 위해 자동으로 종속성 및 업데이트를 처리합니다.

Homebrew를 사용하면 프로그래밍 언어, 라이브러리, 데이터베이스 및 유틸리티를 포함한 다양한 소프트웨어 패키지를 설치할 수 있습니다. 필요한 경우 패키지의 다른 버전을 쉽게 전환할 수 있도록 소프트웨어 버전을 관리하는 데도 사용할 수 있습니다.

Homebrew를 사용하면 소프트웨어를 쉽게 최신 상태로 유지할 수 있다는 장점이 있습니다. brew update 명령을 사용하여 Homebrew 자체를 업데이트한 다음 brew upgrade 명령을 사용하여 Homebrew와 함께 설치한 모든 패키지를 업데이트할 수 있습니다.

전반적으로 Homebrew는 MacOS 시스템의 소프트웨어를 관리하는 강력한 도구이며, 직접 패키지를 설치하고 관리하는 것에 비해 많은 시간과 노력을 절약할 수 있습니다.

 

시스템 요구사항

그럼 설치를 하기 위한 요구 사항을 확인해 볼게요.

  • A 64-bit Intel CPU or Apple Silicon CPU
  • macOS Big Sur (11) (or higher)
  • Command Line Tools (CLT) for Xcode (from xcode-select --install or https://developer.apple.com/download/all/) or Xcode
  • The Bourne-again shell for installation (i.e. bash)

하지만 Xcode가 먼저라는 점~😅

⚠️ 만약 Xcode를 설치하지 않았다면 Mac Full Xcode 설치하기를 먼저 진행해주세요.

 

설치

이제 본격 Homebrew를 설치합니다. 다음의 3가지를 실행하시면 됩니다.

  1. 설치 명령어 실행 : Homebrew에서 명령어 복사 가능합니다.
  2. 비밀번호 입력 : 위의 sudo xcodebuild -license를 실행한 터미널에서 그대로 실행하면 비밀번호를 묻지 않고 넘어가니 참고하세요.
  3. 엔터키 입력
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

==> Checking for `sudo` access (which may request your password)...
Password: ### 비밀번호 입력 ###
==> This script will install:
/opt/homebrew/bin/brew
/opt/homebrew/share/doc/homebrew
/opt/homebrew/share/man/man1/brew.1
/opt/homebrew/share/zsh/site-functions/_brew
/opt/homebrew/etc/bash_completion.d/brew
/opt/homebrew
==> The following new directories will be created:
/opt/homebrew/bin
/opt/homebrew/etc
/opt/homebrew/include
/opt/homebrew/lib
/opt/homebrew/sbin
/opt/homebrew/share
/opt/homebrew/var
/opt/homebrew/opt
/opt/homebrew/share/zsh
/opt/homebrew/share/zsh/site-functions
/opt/homebrew/var/homebrew
/opt/homebrew/var/homebrew/linked
/opt/homebrew/Cellar
/opt/homebrew/Caskroom
/opt/homebrew/Frameworks


Press RETURN/ENTER to continue or any other key to abort: ### Enter 키 입력 ###
...

HEAD is now at 140d44446 Merge pull request #15056 from reitermarkus/fetch-arch
Warning: /opt/homebrew/bin is not in your PATH.
  Instructions on how to configure your shell for Homebrew
  can be found in the 'Next steps' section below.
==> Installation successful!

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics data has been sent yet (nor will any be during this install run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations

==> Next steps:
- Run these two commands in your terminal to add Homebrew to your PATH:
    (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/miky/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"
- Run brew help to get started
- Further documentation:
    https://docs.brew.sh

 

path 설정

저처럼 Warning이 발생하면 Next steps에서 안내하는 명령어 3가지를 실행해 줘요.

### Path 설정
% (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/miky/.zprofile

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

### Homebrew 실행
% 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

설치 확인

마지막으로 설치가 잘 됐는지 확인합니다.

% brew doctor
Your system is ready to brew.

% brew -v
Homebrew 4.0.9

전체 실행 명령어를 보려면 아래의 더보기를 누르세요.

더보기
% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
==> Checking for `sudo` access (which may request your password)...
Password:
==> This script will install:
/opt/homebrew/bin/brew
/opt/homebrew/share/doc/homebrew
/opt/homebrew/share/man/man1/brew.1
/opt/homebrew/share/zsh/site-functions/_brew
/opt/homebrew/etc/bash_completion.d/brew
/opt/homebrew
==> The following new directories will be created:
/opt/homebrew/bin
/opt/homebrew/etc
/opt/homebrew/include
/opt/homebrew/lib
/opt/homebrew/sbin
/opt/homebrew/share
/opt/homebrew/var
/opt/homebrew/opt
/opt/homebrew/share/zsh
/opt/homebrew/share/zsh/site-functions
/opt/homebrew/var/homebrew
/opt/homebrew/var/homebrew/linked
/opt/homebrew/Cellar
/opt/homebrew/Caskroom
/opt/homebrew/Frameworks

Press RETURN/ENTER to continue or any other key to abort:
==> /usr/bin/sudo /usr/bin/install -d -o root -g wheel -m 0755 /opt/homebrew
==> /usr/bin/sudo /bin/mkdir -p /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /bin/chmod ug=rwx /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /bin/chmod go-w /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown miky /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /usr/bin/chgrp admin /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /usr/sbin/chown -R miky:admin /opt/homebrew
==> /usr/bin/sudo /bin/mkdir -p /Users/miky/Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Users/miky/Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown -R miky /Users/miky/Library/Caches/Homebrew
==> Downloading and installing Homebrew...
remote: Enumerating objects: 233829, done.
remote: Counting objects: 100% (199/199), done.
remote: Compressing objects: 100% (158/158), done.
remote: Total 233829 (delta 50), reused 148 (delta 36), pack-reused 233630
Receiving objects: 100% (233829/233829), 67.81 MiB | 15.51 MiB/s, done.
Resolving deltas: 100% (171595/171595), done.
From https://github.com/Homebrew/brew
 * [new branch]          master     -> origin/master
 * [new tag]             0.1        -> 0.1
 * [new tag]             0.2        -> 0.2
 * [new tag]             0.3        -> 0.3
 * [new tag]             0.4        -> 0.4
 * [new tag]             0.5        -> 0.5
 * [new tag]             0.6        -> 0.6
 * [new tag]             0.7        -> 0.7
.........
HEAD is now at 140d44446 Merge pull request #15056 from reitermarkus/fetch-arch
Warning: /opt/homebrew/bin is not in your PATH.
  Instructions on how to configure your shell for Homebrew
  can be found in the 'Next steps' section below.
==> Installation successful!

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics data has been sent yet (nor will any be during this install run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations

==> Next steps:
- Run these two commands in your terminal to add Homebrew to your PATH:
    (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/miky/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"
- Run brew help to get started
- Further documentation:
    https://docs.brew.sh

miky@MiKys-MacBook-Pro ~ % (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/miky/.zprofile
miky@MiKys-MacBook-Pro ~ % eval "$(/opt/homebrew/bin/brew shellenv)"
miky@MiKys-MacBook-Pro ~ % 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
miky@MiKys-MacBook-Pro ~ % brew doctor
Your system is ready to brew.

 

Analytics 거부 처리

Homebrew는 무료 오픈소스 프로그램으로, 사용 데이터를 공유하고 수집을 한다고 해요. 이를 원치 않는 경우에는 아래 명령어를 실행해 줍니다.

% brew analytics off

 

Homebrew 명령어

brew help로 다양한 Homebrew 명령어를 확인할 수 있어요.

% brew help                       ### Homewbrew 명령어 확인
Example usage:
  brew search TEXT|/REGEX/        ### 설치 분류(Fomula/Cask) 확인
  brew info [FORMULA|CASK...]     ### 프로그램 정보 확인
  brew install FORMULA|CASK..     ### 프로그램 설치
  brew update                     ### Homebrew 업데이트
  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

 

자~ 이제 Homebrew 설치가 끝났어요~👏👏👏

이제 필요한 프로그램 설치를 쭉쭉하면 되겠죠?!

개발 환경 설정하기

💡  MacOS에 Flutter 개발 환경 세팅하기 - feat. Homebrew에서 전체 설치 방법을 확인하실 수 있습니다.
  • Xcode, iOS Simulator
  • Homebrew
  • iTerm2
  • Visual Studio Code
  • Flutter
  • CocoaPods
  • Java
  • Android Studio, Android SDK, Android Emulator

반응형