如何在 MacOS 中静默安装 .dmg?

gri*_*yvp 8 installation mac-osx

我有一个 .dmg MacOS 包(带有“继续”按钮、EULA 等),我需要在多台计算机上安装它。它是一种通过 bash/python/ruby/etc 脚本静默安装的方法,就像 Windows 中的静默 MSI 安装一样?我可以自动编写安装脚本,为我单击按钮,但这看起来有点不自然:)。

bal*_*dre 14

要安装 DMG,您可以执行以下操作:

cd ~/Desktop

curl -O http://darwinports.opendarwin.org/downloads/DarwinPorts-1.2-10.4.dmg

hdiutil attach DarwinPorts-1.2-10.4.dmg

cd /Volumes/DarwinPorts-1.2/

sudo installer -pkg DarwinPorts-1.2.pkg -target "/"

hdiutil detach /Volumes/DarwinPorts-1.2/
Run Code Online (Sandbox Code Playgroud)

简而言之,这

  1. 转到您的桌面文件夹
  2. 从 opendarwin 站点获取 DarwinPorts
  3. 安装 dmg
  4. 转到新安装的 DarwinPorts 卷
  5. 以 root 用户身份安装以 root 为目标的软件包
  6. 弹出安装的光盘映像。

然后你可以使用Automator来做到这一点......

取自此页面的代码

  • 赞扬原作者? (7认同)
  • 咳咳……你能评论一下你复制粘贴了 http://codesnippets.joyent.com/posts/show/322 吗?:D (2认同)