Skip to content

Instantly share code, notes, and snippets.

@GUIEEN
Last active August 13, 2019 17:12
Show Gist options
  • Select an option

  • Save GUIEEN/de25d334a2d509a68f6014554936773b to your computer and use it in GitHub Desktop.

Select an option

Save GUIEEN/de25d334a2d509a68f6014554936773b to your computer and use it in GitHub Desktop.
HomeBrew에 대해 잠시 정리해봄. 이제야..🤦‍♂️

Usages

$ brew update                           # Fetch latest version of homebrew and formula.
$ brew tap caskroom/cask                # Tap the Caskroom/Cask repository from Github using HTTPS.
$ brew search slack                     # Searches all known Casks for a partial or exact match.
$ brew cask info slack                  # Displays information about the given Cask
$ brew cask install slack               # Install the given cask.
$ brew cleanup                          # Remove any older versions from the cellar.

HomeBrew

公式:Term 公式:Description 補足 ビール作りでいうと
Formula The package definition パッケージの説明書や手順書 調理法
Keg The installation prefix of a Formula Formula のインストール先パス タル、熟成用
opt prefix A symlink to the active version of a Keg version 違いの keg に対する active への symlink 使用中のタルの目印
Cellar All Kegs are installed here keg 群のインストール先のパス 地下貯蔵室
Tap A Git repository of Formula and/or commands 公式以外の Formula やコマンドがおいてある git リポジトリ 手順書の集まりとすると Cookpad 的な..!?
Bottle Pre-built Keg used instead of building from source ソースからビルドするタイプの build されていない keg keg ができあがったものとすると、こちらは自宅用手作りキッド的な感じ
Cask An extension of homebrew to install macOS native apps macOS の native アプリのパッケージ置き場 自家醸造ビールの酒樽置き場
Brew Bundle An extension of homebrew to describe dependencies アプリなどを一括でインストールするやーつ 1 ずつの手順書があるとすると、全部まとめたオードブル手順書みたいな感じ

기본 명령어

  • Search

    • brew search chrome
  • Install

    • brew install chrome
    • Destination
      • /usr/local/Cellar
    • Alias
      • /usr/location/bin
      • Check the linkage between Alias -> Destination
        • ls -l /usr/local/bin
          total 56
          lrwxr-xr-x  1 outis  admin   33 Feb 20 02:22 2to3 -> ../Cellar/python/3.7.2_2/bin/2to3
          lrwxr-xr-x  1 outis  admin   37 Feb 20 02:22 2to3-3.7 -> ../Cellar/python/3.7.2_2/bin/2to3-3.7
          lrwxr-xr-x  1 outis  admin   26 Feb 20 02:16 ack -> ../Cellar/ack/2.24/bin/ack
          lrwxr-xr-x  1 outis  admin   28 Feb 20 00:59 brew -> /usr/local/Homebrew/bin/brew
          lrwxr-xr-x  1 root   admin   11 Mar 18 13:15 capinfos -> ./wireshark
          lrwxr-xr-x  1 root   admin   11 Mar 18 13:15 captype -> ./wireshark
          lrwxr-xr-x  1 outis  admin   68 Feb 20 01:13 code -> /Applications/Visual Studio Code.app/Contents/Resources/app/bin/code
          lrwxr-xr-x  1 outis  admin   34 Feb 20 01:54 corelist -> ../Cellar/perl/5.28.1/bin/corelist
          
    • Alias in the Library
      • ls ~/Library/LaunchAgents
        com.dropbox.DropboxMacUpdate.agent.plist com.google.keystone.agent.plist          homebrew.mxcl.redis.plist
        
        • 여러 .plist 확장자들이 이곳에 등록되어있는 것을 확인할 수 있다.
    • Example of installing postgresql
      • brew install postgresql
      • ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
        • Symbolic link (-s)로 Library에 link를 만들어준다.
      • CLI alias 등록
        alias pg_start="launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
        alias pg_stop="launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
        
      • pg_start & pg_stop 으로 간단히 관리.
  • List

    • brew list

자주쓰는것들

brew services subcommand:

  • Manage background services with macOS' launchctl(1) daemon manager

    --all run subcommand on all services.

    • [sudo] brew services list

      • List all running services for the current user (or root).
    • [sudo] brew services run (formula|--all)

      • Run the service formula without registering to launch at login (or boot).
    • [sudo] brew services start (formula|--all)

      • Start the service formula immediately and register it to launch at login (or boot).
    • [sudo] brew services stop (formula|--all)

      • Stop the service formula immediately and unregister it from launching at login (or boot).
    • [sudo] brew services restart (formula|--all)

      • Stop (if necessary) and start the service formula immediately and register it to launch at login (or boot).
    • [sudo] brew services cleanup

      • Remove all unused services.

If sudo is passed, operate on /Library/LaunchDaemons (started at boot). Otherwise, operate on ~/Library/LaunchAgents (started at login).

기타

  • パッケージの有効化、無効化
    brew unlink mysql # mysqlを一時的に無効にする。
    brew link mysql # mysql を有効にする。
  • Brew 세팅 보기
    brew --config                                          ✔  930  14:56:34
    HOMEBREW_VERSION: 2.0.4
    ORIGIN: https://github.com/Homebrew/brew
    HEAD: 0f07fe5c5cdfdf0f424bba7b879faa38aedc8ee4
    Last commit: 12 days ago
    Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
    Core tap HEAD: a290f701743966efe7f3df4b8f1474a5a4b56c98
    Core tap last commit: 7 days ago
    HOMEBREW_PREFIX: /usr/local
    HOMEBREW_LOGS: /Users/user_name/Library/Logs/Homebrew
    CPU: quad-core 64-bit broadwell
    Homebrew Ruby: 2.3.7 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
    Clang: 10.0 build 1000
    Git: 2.20.1 => /usr/local/bin/git
    Curl: 7.54.0 => /usr/bin/curl
    Java: 1.8.0_201
    macOS: 10.14.3-x86_64
    CLT: 10.1.0.0.1.1539992718
    Xcode: 10.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment