MAC command to run .pkg file on terminal

I have a .mpkg file that I want to execute from the terminal. I successfully used this command to achieve this

  sudo installer -pkg Snip.mpkg -target / Applications 

But the fact is that when I run this command, I ask me for the administrator password before completing the installation. Is there a way that I can do this without a password, or can I provide a password also in my sudo installer command ...

Also see: - Running .pkg on MAC OS from java code

answer

early

+6
macos
source share
2 answers

Change the password requirement from sudo using the following line in sudoers:

jinith ALL=(ALL) NOPASSWD: ALL 

Note that another solution will add the password to the process list. Mine will make the user jinith run any command like any user without a password.

+2
source share

You should be able to pass the password from stdin :

 echo <password> | sudo -S installer -pkg Snip.mpkg -target /Applications 
0
source share

All Articles