如何使用终端安装 Mac 应用程序

发布于 2024-10-07 05:04:55 字数 970 浏览 0 评论 0原文

苹果建议在提交到Mac应用程序商店之前,使用以下命令测试Mac的安装过程

sudo installer -store -pkg path-to-package -target /

我将应用程序包保存到桌面,然后在终端中发送命令

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

从上面的命令我得到这个

installer: invalid option -
Usage: installer [-help] [-dominfo] [-volinfo] [-pkginfo] [-allow] [-dumplog]
                 [-verbose | -verboseR] [-vers] [-config] [-plist]
                 [-file <pathToFile>] [-lang <ISOLanguageCode>] [-listiso]
                 [-showChoicesXML] [-applyChoiceChangesXML <pathToFile>]
                 [-showChoicesAfterApplyingChangesXML <pathtoFile>]
                 -pkg <pathToPackage>
                 -target <[DomainKey|MountPoint|DiskIdentifier|DeviceNode|UUID]>

我很新到终端。这是什么意思?如何修复它以便我可以按照 Apple 的建议安装应用程序?

Apple suggests that prior to submitting to the Mac application store, the installation process for Macs be tested using the command

sudo installer -store -pkg path-to-package -target /

I saved the application package to the desktop and then in the terminal I sent the command

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

From the above command I get this

installer: invalid option -
Usage: installer [-help] [-dominfo] [-volinfo] [-pkginfo] [-allow] [-dumplog]
                 [-verbose | -verboseR] [-vers] [-config] [-plist]
                 [-file <pathToFile>] [-lang <ISOLanguageCode>] [-listiso]
                 [-showChoicesXML] [-applyChoiceChangesXML <pathToFile>]
                 [-showChoicesAfterApplyingChangesXML <pathtoFile>]
                 -pkg <pathToPackage>
                 -target <[DomainKey|MountPoint|DiskIdentifier|DeviceNode|UUID]>

I am very new to the Terminal. What does this mean and how do I fix it so that I can install the application as suggested by Apple?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

來不及說愛妳 2024-10-14 05:04:55

可能不完全是你的问题..

你的包路径中有空格吗?
为了安全起见,您应该将其用双引号括起来,否则它可以被视为两个单独的参数

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

Probably not exactly your issue..

Do you have any spaces in your package path?
You should wrap it up in double quotes to be safe, otherwise it can be taken as two separate arguments

sudo installer -store -pkg "/User/MyName/Desktop/helloWorld.pkg" -target /
ゞ记忆︶ㄣ 2024-10-14 05:04:55

要禁用输入密码:

sudo visudo

然后添加如下所示的新行并保存:

# The user can run installer as root without inputting password
yourusername ALL=(root) NOPASSWD: /usr/sbin/installer

然后无需密码即可运行安装程序:

sudo installer -pkg ...

To disable inputting password:

sudo visudo

Then add a new line like below and save then:

# The user can run installer as root without inputting password
yourusername ALL=(root) NOPASSWD: /usr/sbin/installer

Then you run installer without password:

sudo installer -pkg ...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文