天天看點

homebrew安裝與使用安裝homebrew入門使用

安裝homebrew

官方網站:https://brew.sh/index_zh-cn.html

終端

中輸入指令

在過程中需要輸入登入密碼

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/universal-darwin18/rbconfig.rb:215: warning: Insecure world writable dir /usr/local/mysql/bin in PATH, mode 040777
==> 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
           

按下Enter鍵繼續進行安裝

==> /usr/bin/sudo /bin/mkdir -p /Users/chao5/Library/Caches/Homebrew
Password:
Sorry, try again.
Password:
           

提示需要輸入密碼,密碼輸入完成後開始下載下傳安裝

==> /usr/bin/sudo /bin/chmod g+rwx /Users/chao5/Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown chao5 /Users/chao5/Library/Caches/Homebrew
==> Downloading and installing Homebrew...
remote: Enumerating objects: 353, done.
remote: Counting objects: 100% (353/353), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 513 (delta 349), reused 349 (delta 348), pack-reused 160
Receiving objects: 100% (513/513), 114.47 KiB | 3.00 KiB/s, done.
Resolving deltas: 100% (403/403), completed with 146 local objects.
From https://github.com/Homebrew/brew
   de72a2310..a72ea8baa  master     -> origin/master
 * [new tag]             2.1.10     -> 2.1.10
HEAD is now at a72ea8baa Merge pull request #6381 from lbergelson/lb_zsh_complete_formula_files
           

網絡有時不穩定,需要等待,安裝完成後

$ brew

能提示出資訊表示安裝成功。

入門使用

通過

$ brew -h

或者

$ brew help

檢視幫助資訊

$ brew -h
Example usage:
  brew search [TEXT|/REGEX/]
  brew info [FORMULA...]
  brew install FORMULA...
  brew update
  brew upgrade [FORMULA...]
  brew uninstall FORMULA...
  brew list [FORMULA...]

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

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

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

提示出常用的指令:

  • brew search [TEXT|/REGEX/]
    • 查詢可用包(檢視包的各個可安裝版本)
$ brew search pandoc
==> Formulae
pandoc ✔                   pandoc-citeproc            pandoc-crossref

If you meant "pandoc" specifically:
It was migrated from homebrew/cask to homebrew/core.
           
  • brew info [FORMULA…]
    • 檢視任意包資訊
$ brew info pandoc
pandoc: stable 2.7.3 (bottled), HEAD
Swiss-army knife of markup format conversion
https://pandoc.org/
/usr/local/Cellar/pandoc/2.7.2 (178 files, 74.3MB) *
  Poured from bottle on 2019-04-08 at 19:59:08
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/pandoc.rb
==> Dependencies
Build: cabal-install ✘, ghc ✘
==> Options
--HEAD
        Install HEAD version
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Analytics
install: 11,488 (30 days), 47,850 (90 days), 258,672 (365 days)
install_on_request: 8,331 (30 days), 34,702 (90 days), 185,395 (365 days)
build_error: 0 (30 days)
           
  • brew install FORMULA…
    • 安裝任意包
  • brew update
    • 更新homebrew
  • brew upgrade [FORMULA…]
    • 更新包,不指定包名預設更新所有的
  • brew uninstall FORMULA…
    • 解除安裝任意包
  • brew list [FORMULA…]
    • 檢視已安裝包清單

繼續閱讀