Mac OS平台下的软件包管理工具,好用到爆炸

这次要讲的工具叫做Homebrew,是一款Mac OS平台下的软件包管理工具,对于macos平台的软件安装非常有用,效率高,而且避开了App Store(我其实很讨厌App Store,但对于专业软件而言很多时候又很难绕开)

Mac OS平台下的软件包管理工具,好用到爆炸

好长时间没用过这个玩意了,今天突然用到,给大家提一提,如果买了mac还没用起来的,12分推荐安装。

Homebrew这个工具支持安装、卸载、更新、查看、搜索等很多实用的功能。通过命令行直接进行软件包的安装,可以无需关注诸多依赖问题(我在ubuntu/centos/suselinux..上经常会遇到直接安装rpm包的场景,依赖问题通常让人吐血又没有太好的解决办法)

如果还是不知道这个是什么呢,我们可以把它类比成:apt-get、yum、zypper、npm、pip,我能想到的差不多就这么多了,再不知道,你只能先用用看了。

Mac OS平台下的软件包管理工具,好用到爆炸

官方对于这个管理工具的定位是:Homebrew installs the stuff you need that Apple (or your Linux system) didn’t.

什么意思呢?简单就是苹果装不了的东西,我来装!硬核!

软件安装通过以下命令来完成安装:

brew install xx

安装后可以通过如下命令来进行一些查看和学习,当然也可以通过官方的指导书来学习,奉上链接:https://docs.brew.sh

Mac OS平台下的软件包管理工具,好用到爆炸

安装非常简单,这里提一下

首先是一些基本要求需要满足:(官方有四条,删除了两条屁话)

macOS High Sierra (10.13) (or higher) 2

Command Line Tools (CLT) for Xcode: xcode-select --install,developer.apple.com/downloads or Xcode 3

安装命令如下(以前貌似还有个ruby命令安装的):

mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew

安装完成后有个源要注意下,这个是国外软件,通常这类包管理软件的源都是默认只想国外的网站的,那么使用的时候,下载速度会特别慢(装个依赖多、包又大的软件,能等到你蛋碎)

以下参考的清华大学的mirror,我平常用的还算比较多(另外比较多的是163和淘宝两个源,都很不错)

git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git

brew update

如果需要还原(我估计没人需要。。。。)

git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git

git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git

git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask.git

brew update

Mac OS平台下的软件包管理工具,好用到爆炸



分享到:


相關文章: