原文首发于@拭目以待个人站,地址:mac神器HomeBrew
mac下的软件实现都感觉像是后娘养的,不仅功能上比windows版本弱爆几条街,而且下载都是问题。
npm install *
简简单单的一行代码,解放了前端的资源下载问题。 而mac下也存在类似的资源管理工具,这个工具叫做Homebrew。
HomeBrew官网地址: http://brew.sh/
首先,需要像在node环境下安装npm一样的安装操作。
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
执行效果如下:
baukhdeMacBook-Pro:main baukh$ /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
==> The following new directories will be created:
/usr/local/Homebrew
/usr/local/Frameworks
/usr/local/sbin
Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/mkdir -p /usr/local/Homebrew /usr/local/Frameworks /usr/local/sbin
Password:
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/Homebrew /usr/local/Frameworks /usr/local/sbin
==> /usr/bin/sudo /bin/chmod 755 /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown baukh /usr/local/Homebrew /usr/local/Frameworks /usr/local/sbin
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/Homebrew /usr/local/Frameworks /usr/local/sbin
==> Downloading and installing Homebrew...
remote: Counting objects: 4124, done.
remote: Compressing objects: 100% (2750/2750), done.
remote: Total 4124 (delta 2084), reused 2648 (delta 1227), pack-reused 0
Receiving objects: 100% (4124/4124), 2.41 MiB | 22.00 KiB/s, done.
Resolving deltas: 100% (2084/2084), done.
安装完之后,可以执行brew命令,来查看下HomeBrew都提供了哪些命令:
baukhdeMacBook-Pro:~ baukh$ brew
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://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md
Further help:
man brew
brew help [COMMAND]
brew home
现在我们尝试安装一下office:
搜索office资源
baukhdeMacBook-Pro:main baukh$ brew search office
goffice
Caskroom/cask/devonthink-pro-office Caskroom/cask/microsoft-office Caskroom/versions/libreoffice-dev
Caskroom/cask/libreoffice Caskroom/cask/openoffice Caskroom/versions/microsoft-office-2011
查找到的资源都会列出来,查完之后,不明觉历,天真的就直接安装office了。然后HomeBrew告诉我,这个资源不存在,并列出了存在的资源。
baukhdeMacBook-Pro:main baukh$ brew install office
Error: No available formula with the name "office"
==> Searching for similarly named formulae...
This similarly named formula was found:
goffice
To install it, run:
brew install goffice
==> Searching taps...
These formulae were found in taps:
Caskroom/cask/devonthink-pro-office Caskroom/cask/microsoft-office Caskroom/versions/libreoffice-dev
Caskroom/cask/libreoffice Caskroom/cask/openoffice Caskroom/versions/microsoft-office-2011
To install one of them, run (for example):
brew install Caskroom/cask/devonthink-pro-office
基本意思就是,名称是名称,资源是资源,粘上个搜索出来的结果,再install下
baukhdeMacBook-Pro:~ baukh$ brew install Caskroom/cask/microsoft-office
==> brew cask install Caskroom/cask/microsoft-office
==> Downloading https://officecdn.microsoft.com/pr/C1297A47-86C4-4C1F-97FA-950631F94777/OfficeMac/Microsoft_Office_2016_15.27.0_16
######################################################################## 100.0%
==> Verifying checksum for Cask microsoft-office
==> Running installer for microsoft-office; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
Password:
==> installer: Package name is Microsoft Office 2016 for Mac
==> installer: Installing at base path /
==> installer: The install was successful.
???? microsoft-office was successfully installed!
这个安装过程会根据所下载资源的大小而快慢不同。
这时,需要做的只是静静的等待出现 *** was successfully installed!
@拭目以待
个人站点:www.lovejavascript.com
表格管理插件:gridmanager.lovejavascript.com && github地址
QQ交流群 (452781895):How To Make Love
《野生前端工程师》专辑中所有文章均为@拭目以待 原创,转载请注明出处。
网友评论