Mac-Osx

如何在 MacOS 中靜默安裝 .dmg?

  • August 6, 2019

我有一個需要在多台電腦上安裝的 .dmg MacOS 包(帶有“繼續”按鈕、EULA 等)。是否像 Windows 中的靜默 MSI 安裝一樣通過 bash/python/ruby/etc 腳本靜默執行此操作?我可以自動化安裝腳本,它會為我點擊按鈕,但這看起來有點不自然:)。

要安裝 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/

簡而言之,這

  1. 轉到您的桌面文件夾
  2. 從 opendarwin 站點獲取 DarwinPorts
  3. 安裝 dmg
  4. 轉到新安裝的 DarwinPorts 卷
  5. 以 root 使用者身份安裝以 root 為目標的軟體包
  6. 彈出已安裝的光碟映像。

然後,您可以使用Automator來執行此操作…

取自此頁面的程式碼

引用自:https://serverfault.com/questions/13587