天天看點

mac OS簡單實用的包管理器Homebrew,真的非常好用

前言

今天安裝zookeeper時使用的是brew方式來安裝,才深深的體會到brew的厲害之處,閑話少叙,進入正題。

Homebrew的使用

1. 安裝Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"      

在1中指令回車之後,會提示​

​Press RETURN to continue or any other key to abort​

​ (回車繼續或者按其他鍵終止),這是直接回車進入“Downloading and installing Homebrew…”,

  1. 如果網絡不好的話可能會提示“fatal: unable to access ‘https://github.com/Homebrew/brew/’: SSLRead() return error -9806…等”,沒關系重新輸入1的指令更新。
  2. 用如下指令下載下傳安裝msf時,提示​

    ​curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused​

    ​ 解決辦法:
  • 打開 https://www.ipaddress.com/ 輸入通路不了的域名,獲得對應的IP。
  • 使用vim /etc/hosts指令打開不能通路的機器的hosts檔案,添加如下内容:
199.232.68.133 raw.githubusercontent.com
199.232.68.133 user-images.githubusercontent.com
199.232.68.133 avatars2.githubusercontent.com
199.232.68.133 avatars1.githubusercontent.com      

注:上面内容中199.232.68.133是raw.githubusercontent.com所在的伺服器IP(通過 https://www.ipaddress.com/ 獲知)。

儲存該檔案,再使用即可正常通路。

HEAD is now at 2b6f47714 Merge pull request #4116 from commitay/zap-force
==> Cleaning up /Library/Caches/Homebrew...
==> Migrating /Library/Caches/Homebrew to /Users/maerfeifei/Library/Caches/Homeb
==> 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:
  https://docs.brew.sh/Analytics.html

==> Next steps:
- Run `brew help` to get started
- Further documentation: 
    https://docs.brew.sh      

2. brew 常用指令(SoftwareName是你需要處理的軟體的軟體名)

  1. 檢視軟體最新版本,​

    ​brew info SoftwareName​

    ​例如
brew info zookeeper      
  1. 安裝軟體,​

    ​brew install SoftwareName​

    ​例如
brew install zookeeper      
  1. 解除安裝軟體:​

    ​rew remove SoftwareName​

    ​例如
brew remove zookeeper      
  1. 檢視通過brew安裝的所有軟體
brew list      
brew list 軟體名      

繼續閱讀