简体   繁体   English

MAC命令在终端上运行.pkg文件

[英]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 我有一个.mpkg文件,我想从终端执行我成功使用此命令来实现此目的

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... 有没有办法可以在没有密码的情况下执行此操作,或者我也可以在我的sudo安装程序命令中提供密码...

Also see :- Running .pkg on MAC OS from java code 另请参阅: - 从java代码在MAC OS上运行.pkg

please reply 请回复

thanks in advance 提前致谢

Remove the password requirement from sudo using the following line in sudoers: 使用sudoers中的以下行从sudo中删除密码要求:

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. 我将使它成为用户jinith可以像没有密码的任何用户一样运行任何命令。

您应该能够从stdin传入密码:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM