在购买新的 macOS 计算机或重新格式化现有计算机时,您需要做的最繁琐的任务就是从头开始安装所有软件应用程序。(apps)首先(First),您必须记住每一个,其次,访问每个应用程序的网站,下载应用程序并安装它需要永远(takes forever)。
但是,如果您有一个下载脚本会自动为您下载并安装每个脚本呢?您所要做的就是运行脚本,然后在脚本运行时离开并给自己泡杯咖啡。您可以使用HomeBrew和HomeBrew Cask来做到这一点。
什么是家酿?(What Is
HomeBrew?)
HomeBrew是一个可以安装在您的 macOS 计算机上的程序,它可以为您下载和安装应用程序,而无需先访问应用程序的网站。您只(Homebrew)需要终端(Terminal)窗口、Homebrew(All)命令和您要下载的应用程序的名称。
并非所有软件应用程序都受HomeBrew支持。稍后我将向您展示如何找出哪些是(ARE)受支持的。但总的来说,所有大牌都支持。
安装 HomeBrew(Installing
HomeBrew)
在我们制作批量MacOS应用程序安装程序之前,我们需要安装HomeBrew和HomeBrew Cask。Cask是一个程序,可让您一次下载所有程序。macOS 应用程序安装程序需要两者才能正常运行。
要安装HomeBrew,请打开终端(Terminal)窗口并输入:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
然后安装HomeBrew Cask,分别输入以下两个命令。
brew tap caskroom/cask
brew install caskroom/cask/brew-cask
这就对了。您现在已经安装了HomeBrew。
要使用HomeBrew(HomeBrew)安装程序,它是一个简单的终端(Terminal)
命令
brew cask install “app name”
显然,您可以将“应用程序名称”替换为您想要的应用程序的名称。
要卸载,您将键入:
brew cask uninstall “app name”
查看 HomeBrew 支持哪些程序(Seeing What
Programs Are Supported By HomeBrew)
在我们继续制作批量应用程序安装程序之前,您需要查看HomeBrew支持哪些程序。除非您正在运行一些没有人听说过的旧的模糊程序,否则HomeBrew很可能会支持它。
但是您需要查看HomeBrew准确调用的程序,以便正确获取命令。否则,您的批量应用程序安装程序将无法正常工作。
所以在终端中,现在输入:
brew search “name of app”
因此,如果您正在搜索是否支持Google Chrome,您可以输入
brew search chrome
终端(Terminal)现在将为您提供与Chrome相关的所有HomeBrew
软件包。
如您所见,Chrome在HomeBrew上列为google-chrome。所以这就是为什么你需要在你的应用安装程序中获得准确的术语。
构建您的应用安装程序(Building Your
App Installer)
一旦您在安装程序中获得了所需的所有应用程序的列表(使用HomeBrew 格式的(HomeBrew-formatted)名称),就可以开始编写脚本了。
打开 macOS 文本编辑器(例如默认的TextEdit)并在顶部输入:
#!/bin/sh
在下一行(the next line),开始为每个程序键入HomeBrew Cask命令,用(HomeBrew Cask)<br>分隔。所以,就像这样:
<br>brew cask install
google-chrome
<br>brew cask install firefox
<br>brew cask install audacity
<br>brew cask install dropbox
等等。继续,直到您列出了所有附有 HomeBrew cask(HomeBrew)命令的程序。
完成后,将文件另存为:
caskconfig.sh
(Take)注意 txt 不在该文件名的末尾。
现在,返回终端,将(Terminal)终端(Terminal)指向您刚刚创建的文件的位置,然后在终端(Terminal)中键入:
chmod a+x caskconfig.sh
这使文件准备好使用。将脚本从您的计算机移至USB记忆棒或云存储。如果您的计算机崩溃,那么在该计算机上安装脚本会使整个练习变得毫无意义!
在新计算机上使用脚本(Using The Script On a New Computer)
在新的或重新格式化的计算机上,安装HomeBrew和
HomeBrew Cask,正如我们刚刚展示的那样。然后将caskconfig.sh移动到 Mac 的主目录中。
最后,启动终端(Terminal)并输入:
./caskconfig.sh
现在坐下来观看脚本中的所有程序都被下载和安装,您无需再付出任何努力!
这个脚本的好处是它只指向在线程序。因此,当您运行脚本时,您将始终获得这些程序的最新版本。不是一些需要在之后安装十几个补丁的非常过时的版本。
How To Make a Bulk App Installer For a New Mac OS Install using HomeBrew
When buying a new macOS computer, or reformatting an existing one, the most tеdious task you need to do is install all of your software apps from scratch. First, you have to remember each one, and secondly, visiting each app’s website, downloading the app, and installing it takes forever.
But what if you had a download script that would
automatically download and install each one for you? All you would have to do
is run the script, then walk off and make yourself a coffee while the script
did its business. You can do that using HomeBrew and HomeBrew Cask.
What Is
HomeBrew?
HomeBrew is a program that can be installed on your macOS computer which downloads and installs apps for you, without the need to visit the app’s website first. All you need is the Terminal window, the Homebrew command, and the name of the app you want to download.
Not all software apps are supported by HomeBrew. I will show you in a moment how to find out which ones ARE supported. But in general, all of the big-name ones are supported.
Installing
HomeBrew
Before we can make our bulk MacOS app installer, we need to install HomeBrew and HomeBrew Cask. Cask is a program that allows you to download programs all at once. Both are required for the macOS app installer to function properly.
To install HomeBrew, open a Terminal window and type :
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then to install HomeBrew Cask, type the following two
commands individually.
brew tap caskroom/cask
brew install caskroom/cask/brew-cask
That is it. You now have HomeBrew installed.
To install a program with HomeBrew, it is a simple Terminal
command of
brew cask install “app name”
Obviously, you would replace “app name” with the name of the app you want.
To uninstall, you would type :
brew cask uninstall “app name”
Seeing What
Programs Are Supported By HomeBrew
Before we move on to making the bulk app installer, you need to see which programs HomeBrew supports. Unless you are running some old vague program that no one had ever heard of, it’s likely HomeBrew will support it.
But you need to see what the program is called exactly by HomeBrew so you get the command right. Otherwise, your bulk app installer is not going to work very well.
So in Terminal, now type :
brew search “name of app”
So if you were searching to see if Google Chrome was
supported, you could type
brew search chrome
And the Terminal will now give you all of the HomeBrew
packages which are to do with Chrome.
As you can see, Chrome is listed on HomeBrew as google-chrome. So this is why you need
to get the exact terminology right in your app installer.
Building Your
App Installer
Once you have a list of all the apps you want in your
installer (with the HomeBrew-formatted names), it’s time to start writing the
script.
Open up a macOS text editor (such as the default TextEdit) and at the top, type :
#!/bin/sh
On the next line,
begin typing the HomeBrew Cask commands for each program, separated by <br>. So, like so :
<br>brew cask install
google-chrome
<br>brew cask install firefox
<br>brew cask install audacity
<br>brew cask install dropbox
And so on. Keep going till you have all of the programs
listed with the HomeBrew cask commands attached.
When you have finished, save the file as :
caskconfig.sh
Take care that txt is not on the end of that file name.
Now, go back to Terminal, point Terminal at the location of
the file you have just made, and in Terminal, type :
chmod a+x caskconfig.sh
This makes the file ready to be used. Move the script off
your computer to either a USB stick or cloud storage. If your computer crashes,
having the script on that computer makes this whole exercise a bit pointless!
Using The Script On a New Computer
On the new or reformatted computer, install HomeBrew and
HomeBrew Cask, as we have just shown. Then move caskconfig.sh into your Mac’s Home Directory.
Finally, fire up Terminal and type :
./caskconfig.sh
Now sit back and watch all of the programs in the script be
downloaded and installed, with zero further effort from you!
The nice thing about this script is that it merely points towards the programs online. So when you run the script, you will always get the most up-to-date versions of those programs. Not some wildly out-of-date version that requires a dozen patches installed afterward.