每隔一段时间,您会发现您的 macOS 系统或计算机上安装的应用程序都有可用的更新。保持系统软件和应用程序处于最新状态非常重要。这可以确保您的系统稳定并且您的应用程序没有错误。
在 Mac 机器上,您有多种方法来更新操作系统和应用程序(ways to update the operating system and applications)。获取和安装新更新的传统方式是在您的计算机上使用官方Mac App Store 。
但是,您不必依赖它来安装更新。您还可以使用终端(Terminal)应用程序在您的计算机上查找、下载和安装各种更新。甚至还有可配置的选项让您决定如何安装这些更新。
从终端更新 macOS 版本(Update The macOS Version From Terminal)
终端(Terminal)有一个命令可以检查 macOS 的所有可用更新,并允许您下载并安装它们到您的机器上。该命令还允许您在Mac上更新(Mac)Apple应用程序,例如 iTunes 。
但它不会为安装在您机器上的第三方应用程序安装更新。对于这些应用程序,您将需要安装本指南后面部分中描述的包。
查找可用的 macOS 系统更新(Find Available macOS System Updates)
您要做的第一件事是检查哪些更新可用于您的 macOS 和Apple应用程序。检查并不一定意味着下载或安装更新。这只是为了让您了解Mac(Mac)上需要更新的内容。
在Mac(Mac)上使用您喜欢的方法启动终端(Terminal)应用程序。
当应用程序启动时,输入以下命令并按Enter。
软件更新 -l(softwareupdate -l)
它会查找所有可用的更新并将它们显示在您的终端(Terminal)窗口中。您将看到的信息包括应用程序名称、更新大小、是否推荐更新以及更新是否需要重新启动计算机。
如果您想这样做,您还可以使用终端(Terminal)检查更新,然后从App Store安装它们。(App Store)
下载 macOS 系统更新(Download macOS System Updates)
在找出可用的更新后,您可能希望将这些更新下载到您的Mac上。请记住,下载也不需要您安装更新。您可以只下载更新而不立即安装它们。
- 启动终端(Terminal)应用程序并输入以下命令并按Enter。
软件更新 -d -a(softwareupdate -d -a)
- 它会下载所有可用的更新,但不会安装它们。您可以在Mac 上的 /Library/Updates/
安装下载的 macOS 更新(Install Downloaded macOS Updates)
您使用终端(Terminal)命令下载的更新无法手动安装。这些更新只能使用终端(installed using a command in the Terminal)应用程序中的命令安装。
要安装它们,您需要首先找出更新的名称,然后使用下面的名称在您的Mac上安装更新。
- 启动终端(Terminal)应用程序,输入以下命令,然后按 Enter(Enter)。确保将update-name替换为您要安装的更新的名称。
软件更新 -i 更新名称(softwareupdate -i update-name)
它会在您的计算机上安装更新时通知您。这应该不会花费太长时间,因为更新已经下载到您的Mac上并且只需要安装它。
下载并安装所有 macOS 更新(Download & Install All macOS Updates)
您在上述部分中所做的就是一点一点地更新内容。如果您想一次性查找、下载和安装所有 macOS 更新怎么办?好吧,终端(Terminal)已经为您服务了。
有一个命令可让您一次执行在Mac上安装所有可用更新。(Mac)
- 打开终端(Terminal)应用程序并在其中运行以下命令。
软件更新 -i -a(softwareupdate -i -a)
该命令将安装所有更新,并在完成时通知您。这将比上述方法花费更长的时间,因为它首先下载所有更新,然后将它们一个一个安装到您的计算机上。
从终端更新 Mac 应用程序(Update Mac Apps From Terminal)
非Apple(Apple)开发的第三方应用程序需要从Mac上的终端(Terminal)更新不同的命令。当您运行上述命令时,这些应用更新不会显示。
为了能够更新您的所有Mac Store 应用程序(Mac Store Apps),您需要在您的机器上安装Homebrew,然后安装“mas”。然后它会让你更新你的其他应用程序。
打开终端(Terminal)应用程序并在其中运行以下命令以安装Homebrew。
/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
安装Homebrew(Homebrew)后,输入以下命令并按Enter安装 mas 实用程序。
冲泡安装mas(brew install mas)
安装 mas 后,您可以运行以下命令来查看可以使用此实用程序更新的所有应用程序的列表。
马斯名单(mas list)
键入以下命令并按Enter 键(Enter)以查看所有需要更新的应用程序。
过时的(mas outdated)
运行以下命令以更新所有过时的应用程序。它将首先为所有过时的应用程序下载更新,然后安装它们,因此预计需要很长时间才能完成。
大规模升级(mas upgrade)
等待(Wait)实用程序更新您的应用程序。完成后,您可以关闭终端(Terminal)窗口。
如果您将来不打算使用这种方式更新应用程序,则不一定需要在Mac上安装mas 和Homebrew 。卸载它们不会影响Mac上更新的应用程序,因此如果您愿意,可以安全地删除它们。
How To Update Mac OS X & Mac Apps From Terminal
Every once in a while, yоu’ll fіnd that an υpdate is available for either your macOS system or the apps installed on your machine. It’s important that yоυ keep your system software and apps υp to date. This ensures your system is stable and your apps аre bug-freе.
On a Mac machine, you have several ways to update the operating system and applications. The traditional way to get and install new updates is to use the official Mac App Store on your machine.
However, you’re not tied to it to install your updates. You can also use the Terminal app to find, download, and install various updates on your machine. There are even configurable options letting you decide how these updates should be installed.
Update The macOS Version From Terminal
Terminal has a command that checks for all the available updates for macOS and allows you to download and install them on your machine. The command also lets you update Apple apps such as iTunes on your Mac.
What it doesn’t do though is to install updates for the third-party apps installed on your machine. For those apps, you’re going to need to install a package that is described in the later part of this guide.
Find Available macOS System Updates
The first thing you’ll want to do is check what updates are available for your macOS and Apple apps. Checking doesn’t necessarily mean downloading or installing updates. It’s just to give you an idea what needs to be updated on your Mac.
Launch the Terminal app using your preferred method on your Mac.
When the app launches, type in the following command and press Enter.
softwareupdate -l
It’ll look for all the available updates and display them in your Terminal window. The information you’ll see include the app names, size of the update, whether the update is recommended or not, and whether the update requires rebooting your machine.
You can also check the updates with Terminal and then install them from the App Store, if you want to do it that way.
Download macOS System Updates
After finding out what updates are available, you might want to download those updates to your Mac. Keep in mind that downloading also doesn’t require you to install the updates. You can just keep the updates downloaded and not install them right away.
- Launch the Terminal app and type in the following command and hit Enter.
softwareupdate -d -a
- It’ll download all the available updates but won’t install them. You’ll find these update files in the /Library/Updates/ folder on your Mac.
Install Downloaded macOS Updates
The updates you download using the Terminal command can’t be manually installed. These updates can only be installed using a command in the Terminal app.
To install them, you need to first find out the name of the update and then use that name below to get the update installed on your Mac.
- Launch the Terminal app, type in the following command, and hit Enter. Make sure to replace update-name with the name of the update you wish to install.
softwareupdate -i update-name
It’ll let you know when the update is installed on your machine. This shouldn’t take too long as the update is already downloaded on your Mac and it just needs to be installed.
Download & Install All macOS Updates
What you did in the above sections was update things bit by bit. What if you want to find, download, and install all the macOS updates in one go? Well, Terminal has you covered.
There’s a command that lets you install all the available updates on your Mac in a single execution.
- Open the Terminal app and run the following command in it.
softwareupdate -i -a
The command will get all updates installed and let you know when it’s done. This’ll take longer than the above methods as it first downloads all the updates and then installs them one by one on your machine.
Update Mac Apps From Terminal
Third-party apps that aren’t developed by Apple require different commands to be updated from the Terminal on your Mac. These app updates won’t show up when you run the commands mentioned above.
In order to be able to update all of your Mac Store Apps, you’re going to need to install Homebrew followed by ‘mas’ on your machine. It’ll then let you update your other apps.
Open the Terminal app and run the following command in it to install Homebrew.
/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
When Homebrew is installed, type in the following command and press Enter to install the mas utility.
brew install mas
When mas is installed, you can run the following command to see a list of all the apps that can be updated using this utility.
mas list
Type in the following command and press Enter to see all the apps that require an update.
mas outdated
Run the following command to update all the outdated apps. It’ll first download updates for all the outdated apps and then install them so expect a good amount of time before it finishes.
mas upgrade
Wait while the utility updates your apps. When it’s done, you can close the Terminal window.
You don’t necessarily need to keep mas and Homebrew installed on your Mac if you don’t plan to update your apps using this way in the future. Uninstalling them won’t affect the updated apps on your Mac so it’s safe to remove them if you want.