How to silently install a pkg file in Mac OS X
Asked Answered
S

3

20

I am developing a Mac OS X application(cloud printing application). To run my application i need some support drivers. So i packed those drivers and my application using package maker software. And i created a pkg file.

It working fine as a package installer. But i need to silently install this package by running by scripts / commands in terminal.

PS : Silent install is the method that will install the software with any user intervention(like agree the terms). it will silently install the software using admin privillages by using terminal commands. On windows side it is possible to do this silent install.

Can anyone provide the solution to do this silent install in package installer?

Serilda answered 4/2, 2015 at 7:4 Comment(0)
S
26

Before moving to other installers, we can silently install the installer package using the below command

sudo installer -store -pkg "/User/MyName/Desktop/helloWorld.pkg" -target /

Got the reference from this link.

Serilda answered 5/2, 2015 at 5:53 Comment(1)
At least on MacOS Sierra, the parameter -store should be omitted if installing a package directly.Sendai
D
6

In order to install *.pkg file silently, it needs to have administrator privileges. Just run my command below if you have administrator password: echo "your_admin_pwd" | sudo -S installer -allowUntrusted -verboseR -pkg "path/to/your.pkg" -target /

Demobilize answered 31/12, 2015 at 4:27 Comment(1)
I know the question is old, but echo "your_admin_pwd" | sudo -S <command> is a bad idea, password will be leaked in bash/zsh history. It is better to ask for initial elevation to install the PKG initially and then perform tasks with elevated privileges. You also may not know administrator's password if macOs is unmanaged. If a very silent installation is needed, an MDM solution would be strongly advised.Aristotelian
R
2

you can use [platypus] or [pkginastall] library

I have not used it myself.

Robles answered 4/2, 2015 at 7:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.