OSX - 从命令行运行时安装程序失败

时间:2012-05-24 14:48:18

标签: macos installation

我正尝试从命令行在Mac上安装我们的产品:

$ installer -package /Volumes/setup.pkg/setup.pkg -target /Volumes/MacOS -verbose
installer: Package name is Foo
installer: Upgrading at base path /
installer: Preparing for installation….....
installer: Preparing the disk….....
installer: Preparing Foo….....
installer: Waiting for other installations to complete….....
installer: Configuring the installation….....
installer:  
installer: Writing files….....
#
installer: Writing files….....
#
installer: Writing files….....
#
installer: Moving items into place….....
##
installer: The upgrade failed (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.)

从GUI运行时一切都很好。 sudo无济于事。我该如何调试?至少我需要一个更丰富的日志。将有很大的责任。

自最初发布以来的其他信息:从GUI运行时,应用程序安装在运行它的用户的$ {HOME} / Library中(按照预期)。从命令行运行时,它会尝试将其安装到/ Library中(甚至复制那里的一些文件,但不是所有文件)。

1 个答案:

答案 0 :(得分:3)

在GUI中,您没有明确指定目标,所以一切都在程序包想要放置它的位置。但是在命令行中,你明确指定-target /Volumes/MacOS,它覆盖了包指定的内容,所以它试图将文件放在/Library内,可能是其他地方,其中一些你没有有权访问。

显然-target CurrentUserHomeDirectory解决了这个问题。

要获得更多细节,您需要提取包(在空目录中最简单的方法是xar -xf setup.pkg)并查看文件Distribution,* / PackageInfo以及可能的* / Bom,查看安装程序正在指定的内容。但如果你只是想让它发挥作用,你就已经知道如何做到这一点。