Homebrew intro
Homebrew
Homebrew์ ์์ ๋งฅ์ฃผ, ํจํค์ง ๊ด๋ฆฌ์์คํ
(Chocolatey for Windows, apt-get for dpkg, or yum for RPM.)
์ฌ์ฉ์๊ฐ ํจํค์ง๋ฅผ ๋น๋ํ๊ณ ๋ฒ์ ๋ณ ๊ด๋ฆฌํ๊ฒ ํด์ค๋ค๋ ์๋ฏธ
- 3th-party Package Manager (for missing package of OS X)
OS X์ ์ค์น๋์ด ์์ง ์์ Unixํฉํค์ง๋ฅผ ์ค์น/์ฌ์ฉ/์ ๊ทธ๋ ์ด๋/์ญ์ - ๊ด๋ฆฌ์ ๊ถํ์ด ํ์์๋ค (sudo)
- ์ค์นํ ํฉํค์ง๋ฅผ ๋ฒ์ ๋ณ๋ก ์ฌ์ฉ
- ๊ฐ๊ฐ์ ํฉํค์ง๋ณ๋ก ์ค์น๋๋ ์คํํ์ผ๊ณผ ๋ผ์ด๋ธ๋ฌ๋ฆฌ, ํค๋ํ์ผ์ ๊ฐ๋ฐํ ๋ ํฉํค์ง๋ฅผ ์ฐพ๋๋ฐ ํจ๊ณผ์ ์ด๋ค.
์ฉ์ด ์ ์
HomeBrew | ์๊ฐ ์์กฐ | ์ํํธ์จ์ด ์๊ฐ ๊ตฌ์ถ |
---|---|---|
Formula | ๋จ๊ณ๋ณ ์๋ฆฌ๋ฒ | ๋น๋ ๋ฐฉ๋ฒ/์ ์ฐจ๊ฐ ์์ฑ๋ ์คํฌ๋ฆฝํธ(.rb)
ํฉํค์ง์ ๊ด๋ จ dependency๋ฅผ ์ค์นํ๋ ๋ฐฉ๋ฒ |
Caskroom
cask brew-cask |
extend Homebrew |
ํฉํค์ง ์ค์ ๊ฒฝ๋ก /usr/local/Caskroom |
Celler | ์์ธ์ด๋ ๋งฅ์ฃผ ๋ฑ์ ์ ์ฅ๊ณ |
ํ๋ก๊ทธ๋จ ์ค์น์ฅ์
Package๋ฅผ ์์ ์ Cellar(/usr/local/Cellar/ํฉํค์ง๋ช
)์ ์ค์นํ๊ณ , |
Keg | ์ ์ฅ์ฉ ์์ ํต |
Build ์๋ฃ
A โKegโ is the installation prefix of a formula, such as: openssl-1.0.2h_1.el_capitan.bottle.tar.gz |
bottle | pre-built binary Keg used for installation instead of building from source. It can be unpacked |
|
Cask | ||
tap | /usr/local/Homebrew/Library/Taps/ | |
Brew | ์์กฐ | ์ํํธ์จ์ด Build |
Package ์ค์น
์ฐ์ ํด๋น Package๋ฅผ ๊ฒ์ํด ๋ณธ๋ค. ์ด๋ ์ค์น๋ Package๋ ์ฒดํฌํ์๊ฐ ๋์ด ์๋ค.
(์๋ฅผ๋ค์ด ๊ตณ์ด brew list | grep -i NginX
๋ก ์ค์น์ฌ๋ถ๋ฅผ ํ์ธํ ํ์์์)
brew search vim
์ค์นํ, ์ญ์ ํ๊ณ ์ถ์๋๋ brew uninstall ์ฌ์ฉ.
brew install vim
Documentation
brew
brew help
Example usage: brew search [TEXT|/REGEX/] brew (info|home|options) [FORMULA...] brew install FORMULA... brew update brew upgrade [FORMULA...] brew uninstall FORMULA... brew list [FORMULA...] Troubleshooting: brew config brew doctor brew install -vd FORMULA Developers: brew create [URL [--no-fetch]] brew edit [FORMULA...] https://docs.brew.sh/Formula-Cookbook Further help: man brew brew help [COMMAND] brew home
๋ฉ๋ด์ผ
man brew
Homebrew ๊ด๋ฆฌ
ํฉํค์ง ๋ฆฌ์คํธ ์ ๋ฐ์ดํธ
์ ๋ฒ์ ์ผ๋ก ์ ๋ฐ์ดํธํ ๋์ ์ํํธ์จ์ด๊ฐ ๋ฌด์์ธ์ง ํ์ธ
brew update
์ค์นํ ํฉํค์ง ์ ๊ทธ๋ ์ด๋
์ ์ฒด ํฉํค์ง(์ธ์ ์์ด) ๋๋ ํน์ ํฉํค์ง ํฉํค์ง ์ต์ ์ค์น, brew upgrade <ํฉํค์ง๋ช >
brew upgrade
Caches
๋ค์ด๋ก๋ํ bottles ๋ชฉ๋ก (~/Library/Caches/Homebrew)
brew โcache
Tap (= get Cask, repository)
Homebrew์ master repository์ ํฌํจ๋์ง ์๋ repository๋ฅผ ์ฐธ์กฐํ ๋
brew tap # list tapped repositories brew tap <tapname> # add tap brew untap <tapname> # remove a tap
homebrew-core : default๋ก ์ค์น๋ tap (/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core)
homebrew-science
homebrew-php
homebrew-nginx
……..
Formulas
Homebrew์ ์ค์นํ ์ ์๋ ํฉํค์ง๋ค, ์ผ์ข
์ ํฉํค์ง ์ค๋ช
(์ด ๋ชฉ๋ก์ /usr/local/Library/Formulas ์์ ์์)
ํด๋น ํฉํค์ง๋ฅผ ๋ค์ด์ ๋ฐ์ ์ค์นํ๋ .rb ํ์ผ
-
http://braumeister.org provides recent activity. => http://braumeister.org/formula/wget
brew install <formula>
brew install Repository/<formula> => brew tap <Repository> + brew install <formula>
์> wget ํ๋ก๊ทธ๋จ์ formula
Formula๋ ๊ฐ๋จํ Ruby ์คํฌ๋ฆฝํธ์
๋๋ค (package .rb )
class Wget < Formula homepage "https://www.gnu.org/software/wget/" url "https://ftp.gnu.org/gnu/wget/wget-1.15.tar.gz" sha256 "52126be8cf1bddd7536886e74c053ad7d0ed2aa89b4b630f76785bac21695fcd" def install system "./configure", "--prefix=#{prefix}" system "make", "install" end end
Fomular๋ฅผ ํตํ ์ค์น๋ /usr/local/binํด๋์ wget ์ ์ค์นํ๋ค.
ํฉํค์ง ์ค์น | brew install Formulas |
ํฉํค์ง ์ญ์ | brew remove Formulas |
ํฉํค์ง ์ ๋ณด | brew info Formulas |
(์ค์นํ) ํฉํค์ง ๋ชฉ๋ก | brew list ๋๋ brew ls => ls /usr/local/Cellar |
(์ค์นํ) ํฉํค์ง ์ต์ ๋ฒ์ ํ์ธ | brew outdated |
(์ค์นํ) ํฉํค์ง์ ์ต์ ๋ฒ์ ์ผ๋ก ์ค์น | brew upgrade [Formulas] |
ํฉํค์ง ๊ณผ๊ฑฐ๋ฒ์ ์ ๊ฑฐ | brew cleanup |
ํฉํค์ง ๋ฒ์ ์ ํ | brew switch [Formulas ๋ฒ์ ] |
ํฉํค์ง ๊ณผ๊ฑฐ ๋ฒ์ ํ์ธ | brew versions |
ํจํค์ง ๋นํ์ฑํ ๋ฐ ํ์ฑํ
$ brew unlink wget # ์ผ์์ ์ผ๋ก ๋นํ์ฑํ $ brew link wget # ํ์ฑํ $ brew remove wget # ํจํค์ง ์ ๊ฑฐ
Homebrew ์ค์น
Preparations , ์ค๋น
App store์์ Xcode ์ค์น ํ, Xcode Command Line Tool ์ค์น
xcode-select --install
Xcode license ๋์
sudo xcodebuild -license
Xcode ์คํ
๋๋์ด, ์ค์น
์คํฌ๋ฆฝํธ ์คํ
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" ==> This script will install: /usr/local/bin/brew /usr/local/share/doc/homebrew /usr/local/share/man/man1/brew.1 /usr/local/share/zsh/site-functions/_brew /usr/local/etc/bash_completion.d/brew /usr/local/Homebrew Press RETURN to continue or any other key to abort ==> Downloading and installing Homebrew... remote: Counting objects: 5732, done. remote: Compressing objects: 100% (3562/3562), done. remote: Total 5732 (delta 3182), reused 3797 (delta 1990), pack-reused 0 Receiving objects: 100% (5732/5732), 3.37 MiB | 284.00 KiB/s, done. Resolving deltas: 100% (3182/3182), 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] 1.1.8 -> 1.1.8 * [new tag] 1.1.9 -> 1.1.9 HEAD is now at 30582a5 Merge pull request #2486 from reitermarkus/fix-audit ==> Tapping homebrew/core Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'... remote: Counting objects: 4347, done. remote: Compressing objects: 100% (4154/4154), done. remote: Total 4347 (delta 37), reused 449 (delta 18), pack-reused 0 Receiving objects: 100% (4347/4347), 3.47 MiB | 163.00 KiB/s, done. Resolving deltas: 100% (37/37), done. Tapped 4158 formulae (4,387 files, 10.9MB) ==> Cleaning up /Library/Caches/Homebrew... ==> Migrating /Library/Caches/Homebrew to /Users/onesixx/Library/Caches/Homebrew ==> Deleting /Library/Caches/Homebrew... Already up-to-date. ==> Installation successful! ==> Homebrew has enabled anonymous aggregate user behaviour analytics. Read the analytics documentation (and how to opt-out) here: http://docs.brew.sh/Analytics.html ==> Next steps: - Run `brew help` to get started - Further documentation: http://docs.brew.sh
์ค์น ํ, profile์ ์ฌ๋ณผ๋ฆญ ๋งํฌ๊ฐ ์๋ /usr/local/bin/ ์ ์ถ๊ฐ
echo export PATH="/usr/local/bin:$PATH" >> ~/.bash_profile
#~/.bash_profile export CLICOLOR=1 export PATH="/usr/local/sbin:$PATH"
zsh ์ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ์๋ .bash_profie ๋์ ์ .zshrc ์ ~
ํญ ์๋์์ฑ ํ์ฑํํ๊ธฐ
์๋์ ๋ช
๋ น์ ~/.bash_profile (~/.profile, ~/.bashrc)์คํ์คํฌ๋ฆฝํธ์ ๋ฃ์ด๋๋ฉด,
brew ๋ช
๋ น์ tab ์๋์์ฑ์ผ๋ก ์ฌ์ฉํ ์ ์๋ค.
source `brew --repository`/Library/Contributions/brew_bash_completion.sh source `brew --prefix`/Library/Contributions/brew_bash_completion.sh
์ค์น ํ ํ์ธ
$ brew doctor
Your system is ready to brew.
์ค์น๋ ํฉํค์ง ๋ชฉ๋ก
$ brew list
ํ์ ์ค์น
Java
$ brew cask install java
XQuartz
$ brew install Caskroom/cask/xquartz
์ถ๊ฐ์์
OS X ์ Brew์ค์
El capitan OS ์ ‘์์คํ
๋ฌด๊ฒฐ์ฑ ๋ณดํธ(System Integrity Protection)’์ธ “rootless”๋ Homebrew ์ค์น ํด๋์ธ /usr/local ํด๋์๋
์ํฅ์ ์ฃผ์ง ์๋๋ค.
/usr/local์ด ์กด์ฌํ๋ ๊ฒฝ์ฐ, ํด๋์ ํผ๋ฏธ์ ์ด ๋ณ๊ฒฝํจ
sudo chown $(whoami):admin /usr/local && sudo chown -R $(whoami):admin /usr/local
๊ณ์ “already up-to-date”๋ก ํ์ ๋๋ ๊ฒฝ์ฐ
16.10.11 ์ ๋ฐ์ดํธ ์๋ฌ ์ฒ๋ฆฌ
cd "$(brew --repo) " && git fetch && git reset --hard origin/master && brew update
Homebrew ์ ๋ณด ํ์ธ
๋ฒ์ ํ์ธ
brew -v
Homebrew 1.1.12 Homebrew/homebrew-core (git revision 6f2e; last commit 2017-04-13)
์ค์น์์น
which brew
/usr/local/bin/brew
์ค์
brew config
HOMEBREW_VERSION: 1.1.12 ORIGIN: https://github.com/Homebrew/brew HEAD: 8ea778f7c7ea790694485030d105a92a9416ef33 Last commit: 11 days ago Core tap ORIGIN: https://github.com/Homebrew/homebrew-core Core tap HEAD: 6f2e60d8a664a024d77bc4875cfffbf7b75452f6 Core tap last commit: 38 minutes ago HOMEBREW_PREFIX: /usr/local HOMEBREW_REPOSITORY: /usr/local/Homebrew HOMEBREW_CELLAR: /usr/local/Cellar HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com CPU: octa-core 64-bit ivybridge Homebrew Ruby: 2.0.0-p648 Clang: 8.1 build 802 Git: 2.11.0 => /Applications/Xcode.app/Contents/Developer/usr/bin/git Perl: /usr/bin/perl Python: /usr/bin/python Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby Java: N/A macOS: 10.12.4-x86_64 Xcode: 8.3.1 CLT: 8.3.0.0.1.1490382677 X11: N/A
์ ๋ณดํ์ธ
kegs (Files) ์ซ์ ์ ์ฐจ์งํ๋ disk space
brew info -all
15 kegs, 18,528 files, 540.6M
Homebrew ์ ๊ฑฐ
$ cd `brew --prefix` $ rm -rf Cellar $ brew prune $ rm `git ls-files` $ rmdir Library/Homebrew Library/Aliases Library/Formula Library/Contributions $ rm -rf .git $ rm -rf ~/Library/Caches/Homebrew
$ rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
https://github.com/Homebrew/brew/blob/master/docs/Tips-N’-Tricks.md
https://wilsonmar.github.io/macos-homebrew/
http://tristanpenman.com/blog/posts/2015/10/20/installing-r-and-rstudio-on-mac-os-x/
https://github.com/mimul/dev-environment/blob/master/mac-homebrew.md
https://andromedarabbit.net/wp/homebrew-%EC%82%AC%EC%9A%A9%EB%B2%95/
https://github.com/Homebrew/brew
http://blog.saltfactory.net/mac/install-unix-packages-on-macosx-via-homebrew.html
https://rud.is/b/2015/10/22/installing-r-on-os-x-100-homebrew-edition/
https://raw.githubusercontent.com/Homebrew/install/master/install
http://brew.sh/index_ko.html
http://python-guide-kr.readthedocs.io/ko/latest/starting/install/osx.html