Jinith
Jinith

Reputation: 1007

MAC command to run a .pkg file on terminal

I have a .mpkg file which i want to execute from the terminal I sucessfully used this command to achive this

sudo installer -pkg Snip.mpkg -target /Applications

But the thing is that when i run this command it ask me for the admin password before performing the installation. Is there a way i can do this without the password or can i provide the password also in my sudo installer command...

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

please reply

thanks in advance

Upvotes: 7

Views: 26448

Answers (2)

hd1
hd1

Reputation: 34677

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

jinith ALL=(ALL) NOPASSWD: ALL 

Do note the other solution will add the password to the process list. Mine will make it so that user jinith can run any command as any user without a password.

Upvotes: 2

aqua
aqua

Reputation: 3375

You should be able to pass in the password from stdin:

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

Upvotes: 0

Related Questions