文章目录

  • 一、关于 softwareupdate
    • 相关GUI
    • 相关配置文件
  • 二、使用示例
    • 查看更新
    • 应用建议的更新(recommended updates)
    • 安装系统所有的更新
    • 忽略某个更新
    • 重置忽略的更新
    • 关闭/开启 后台自动更新的检查
    • 查看下载安装进度
    • 查看更多选项
    • 下载但不安装
    • 取消下载
  • 三、manual
    • NAME
    • SYNOPSIS
    • DESCRIPTION
    • EXAMPLES
  • 相关资料

本文基于 macOS 11.2

一、关于 softwareupdate

softwareupdate : system software update tool,系统软件更新工具


相关GUI

系统偏好设置 – 软件更新



  • 《macOS 使用手册》:在 Mac 上更改“软件更新”偏好设置
    https://support.apple.com/zh-cn/guide/mac-help/mchla7037245/mac

相关配置文件

/Library/Preferences/com.apple.SoftwareUpdate.plist

这里记录着 softwareupdate 相关配置数据

$ plutil -p /Library/Preferences/com.apple.SoftwareUpdate.plist
{"AutomaticallyInstallMacOSUpdates" => 0  # 自动安装 macOS 更新"AutomaticCheckEnabled" => 0  # 是否开启 自动检测 "AutomaticDownload" => 0 # 自动下载"ConfigDataInstall" => 0 "CriticalUpdateInstall" => 0"InactiveUpdates" => []"LastAttemptBuildVersion" => "11.2 (20D64)""LastAttemptSystemVersion" => "11.2 (20D64)""LastBackgroundSuccessfulDate" => 2020-09-24 11:35:54 +0000"LastFullSuccessfulDate" => 2021-03-09 10:36:43 +0000"LastRecommendedMajorOSBundleIdentifier" => """LastRecommendedUpdatesAvailable" => 0"LastResultCode" => 2"LastSessionSuccessful" => 1"LastSuccessfulDate" => 2021-03-09 10:36:47 +0000"LastUpdatesAvailable" => 0"PrimaryLanguages" => [0 => "zh-Hans-CN"1 => "zh-Hans"2 => "fr-CN"3 => "en-GB"]"RecommendedUpdates" => [  # 建议安装的更新]"SkipLocalCDN" => 0
}

你也可以使用 defaults 命令来修改配置
defaults 使用方法可参考:https://blog.csdn.net/lovechris00/article/details/113280758


二、使用示例

以下示例大部分来自 How To Update Apple OS X Using Command Line Software Update Tool


查看更新

$ softwareupdate -l
Software Update ToolFinding available software
No new software available.

除了查看命令,其他命令均需要管理员权限


应用建议的更新(recommended updates)

所有建议的更新

$ sudo softwareupdate -r

安装系统所有的更新

$ sudo softwareupdate -i -a

$ softwareupdate --all --install --force # 强制安装所有
Software Update ToolFinding available software
Attempting to quit apps: ("com.apple.Compressor"
)
Successfully quit all appsDownloading 专业视频格式
Downloaded 专业视频格式
Installing 专业视频格式
Done with 专业视频格式
Done.

忽略某个更新

比如忽略 JavaForOSX 更新

$ sudo softwareupdate --ignore JavaForOSX

重置忽略的更新

$ sudo softwareupdate --reset-ignored

关闭/开启 后台自动更新的检查

开启

$ sudo softwareupdate --schedule on

关闭

$ sudo softwareupdate --schedule off

查看下载安装进度

$ sudo softwareupdate -vi RAWCameraUpdate6.17-6.17

或者

sudo softwareupdate -v -i iTunesXPatch-12.3.1

查看更多选项

$ man softwareupdatesoftwareupdate -h

下载但不安装

$ sudo softwareupdate -d nameHere
$ sudo softwareupdate -d iTunesXPatch-12.3.1

取消下载

$ sudo softwareupdate -e

三、manual

softwareupdate(8) BSD System Manager’s Manual softwareupdate(8)

NAME

softwareupdate – system software update tool


SYNOPSIS

softwareupdate command [args …]


DESCRIPTION

Software Update checks for new and updated versions of your software based on information about your computer and current software.

Invoke softwareupdate by specifying a command followed by zero or more args.

softwareupdate requires admin authentication for all commands except –list.

​ If you run softwareupdate as a normal admin user, you will be prompted for a password where required.

​ Alternatively, you can run softwareupdate as root and avoid all further authentication prompts.


The following commands are available:


-l | –list
​ List all available updates.


-i | –install
​ Each update specified by args is downloaded and installed. args can be one of the following:

  • -r | --recommended
    ​ All updates that are recommended for your system. These are prefixed with a * character in the –list output.

  • -R | --restart
    ​ Automatically restart (or shut down) if required to complete installation. If the user invoking this tool is logged in then macOS will attempt to quit all applications, logout, and restart. If the user is not logged in, macOS will trigger a forced reboot if necessary. If you wish to always perform a forced reboot, pass -f (–force).

  • -a | --all All updates that are applicable to your system, including those non-recommended ones, which are prefixed with a - character in the –list output. (Non-recommended updates are uncommon in any case.)

  • item … One or more specified updates. The –list output shows the item names you can specify here, prefixed by the * or - characters. See EXAMPLES.


-d | –download
​ Each update specified by args is downloaded but not installed. The values of args are the same as for the –install command. Updates downloaded with –download can be subsequently installed with –install, or through the App Store (as long as they remain applicable to your system).
Updates are downloaded to /Library/Updates, but are not designed to be installed by double-clicking the packages in that directory: always use –install or the App Store to actually perform the install.


–schedule Returns the per-machine automatic (background) check preference.


-h | –help
​ Print command usage.


EXAMPLES

The following examples are shown as given to the shell:

 softwareupdate --list​      Software Update Tool​      Finding available software​      Software Update found the following new or updated software:​       * Label: MacBookAirEFIUpdate2.4-2.4​          Title: MacBook Air EFI Firmware Update, Version: 2.4, Size: 3817K, Recommended: YES, Action: restart,​       * Label: ProAppsQTCodecs-1.0​          Title: ProApps QuickTime codecs, Version: 1.0, Size: 968K, Recommended: YES,​       * Label: JavaForOSX-1.0​          Title: Java for OS X 2012-005, Version: 1.0, Size: 65288K, Recommended: YES,

  sudo softwareupdate --install JavaForOSX-1.0​      Software Update Tool
​      Finding available software​      Downloading Java for OS X 2012-005
​      Downloaded Java for OS X 2012-005
​      Installing Java for OS X 2012-005
​      Done with Java for OS X 2012-005
​      Done.

sudo softwareupdate --schedule
​ Automatic check is on

Mac OS September 11, 2012 Mac OS


相关资料

  • How to apply OS X software updates from the command line
    https://www.cnet.com/news/how-to-apply-os-x-software-updates-from-the-command-line/

  • How To Update Apple OS X Using Command Line Software Update Tool
    https://www.cyberciti.biz/faq/apple-mac-os-x-update-softwareupdate-bash-shell-command/


伊织 2021-03-09

macOS Command - softwareupdate相关推荐

  1. macOS Command - pkgutil

    文章目录 一.关于 pkgutil reciept & bom 二.使用示例 Receipt Database Commands 查看所有 pkgs 显示某软件包安装的文件列表 查看 pkg ...

  2. macOS Command - xattr

    xattr 命令简介 xattr – display and manipulate extended attributes xattr 命令用于展示和修改扩展属性: 个人认为 xattr 可以看做是 ...

  3. macos 终端下载_如何使用终端下载macOS更新

    macos 终端下载 Tired of opening the Mac App Store to install macOS updates? Use the Terminal instead. 厌倦 ...

  4. Mac常用快捷键(MacOs/AndroidStudio等)

    Mac常用快捷键 MacOs AndroidStudio MacOs command+N : (app)新建窗口 command+M : (app)缩小窗口 command+Q : (app)关闭当前 ...

  5. 推荐使用的几款Java常用基础工具库

    通用工具类(字符串.时间格式化.BeanUtils.IO) 1. commons-lang3库 1.1. org.apache.commons.lang3.StringUtils类 日常代码中,我们经 ...

  6. 这声音酥了!萌妹程序员鼓励师24小时在线陪你写代码,给我吹爆这个VSCode插件...

    开源最前线(ID:OpenSourceTop) 猿妹综合整理 项目地址:https://github.com/SaekiRaku/vscode-rainbow-fart 最近,Github上有一个名为 ...

  7. vscode卸载background插件_萌妹程序员鼓励师24小时在线陪你写代码,给我吹爆这个VSCode插件...

    开源最前线(ID:OpenSourceTop) 猿妹综合整理 项目地址:https://github.com/SaekiRaku/vscode-rainbow-fart 最近,Github上有一个名为 ...

  8. 计算基因组学需要计算机知识吗,生物信息学——计算基因组学的一些参考书

    有两个都可以在新浪爱问资料 Bioinformatics.For.Dummies.2nd.Ed.2007.pdf An Introduction to Bioinformatics Algorithm ...

  9. 萌妹子语音在线吹彩虹屁陪你写代码!一个神奇的 VSCode 插件

    来源 | 程序员的那些事 一个神奇的 VSCode 插件 最近在 GitHub 发现了一个有趣的 VSCode 插件:Rainbow Fart.在你写代码的时候,可根据关键字播放接近代码含义的语音. ...

  10. IDEA使用和实用小技巧

    1.var 变量定义 //"hello".var String str = "hello"; // 10.var int i = 10; // 8.88.var ...

最新文章

  1. 写得不错的几篇C/C++博客
  2. Windows10下OpenCV_contrib安装配置
  3. 在 Delphi 下使用 DirectSound (14): 测试镶边效果器 IDirectSoundFXFlanger8
  4. MongoDB 新功能介绍-Change Streams
  5. mahout0.7 示例运行纪实
  6. NPAPI:WINDOWS中,调用函数不能阻塞
  7. windows10pygame下载安装问题描述
  8. HBase学习总结(1):HBase的下载与安装
  9. HTML+CSS实战:做一个京东登录页面
  10. 判断字符串是否为空方法
  11. 运营MM又来求我发软文了......
  12. 看了后非常震撼---骗局
  13. 渠道分析 之 渠道分析的价值 -3
  14. Power Apps遇到问题整理
  15. android sim卡槽,一加5怎么装卡/插卡 一加手机5 SIM卡安装图文教程
  16. AE+VS+c#开发颜色符号系统之点值符号化(七)
  17. 手把手教你用vue+JavaScript+openlayers+iview制作实时天气预报图
  18. 《科技服务与价值链》总结
  19. 关于MAX3232ESE+T的过热问题
  20. bzoj2150部落战争 最小路径覆盖

热门文章

  1. MySQL从入门到精通之sql语言---(9月2日更新)
  2. (一)安装Emacs
  3. Hadoop1.0和2.0的主要区别
  4. idea 2021 IDEA的Persistence 窗口 查看ERD关系图
  5. MySQL的sql大于号(小于号)的使用
  6. 四柱排盘系统--阳历转农历
  7. Elasticsearch(Transport Client)常用操作
  8. 以太坊编程入门实战-熊健-专题视频课程
  9. 打开Adobe Premiere Pro提示“由于找不到msvcp110.dll,无法继续执行代码。重新安装程序可能会解决此问题”。【方法适用于几乎所有dll文件丢失时】
  10. php 邮件 延迟发送,PHP后台隔5分钟发送email邮件_php