创建一个最小的macOS应用程序包

时间:2016-10-28 16:41:28

标签: macos osx-elcapitan

我正在尝试创建一个最小的应用程序包。我在apple.com上找到了以下页面:

https://developer.apple.com/library/content/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html

我的Info.plis如下:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleExecutable</key>
    <string>MyApp</string>
    <key>CFBundleSignature</key>
    <string>MYAP</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleVersion</key>
    <string>1.0.0</string>
    <key>CFBundleIdentifier</key>
    <string>com.myself.myapp</string>
    <key>CFBundleDisplayName</key>
    <string>MyApp</string>
    <key>CFBundleName</key>
    <string>MyApp</string>
</dict>
</plist>

我的可执行文件是一个文件文件,其权限-rwxrwxr--表示:

#!/bin/sh
touch ~/Desktop/hello.txt

我可以在终端中执行。 我的文件夹结构如下:

MyApp.app/
   Contents/
      Info.plist
      MacOS/
          MyApp
      Resources/

所以我希望这个应用程序能够运行。然而,当我点击它时,我收到以下消息:

  

您无法打开应用程序“MyApp.app”,因为PowerPC   不再支持应用程序。

有谁知道这是关于什么的?操作系统如何确定这是一个PowerPC应用程序? 我的OSX版本是10.11.6(15G1108)。我认为这适用于10.11.5

编辑:添加了Shebang

1 个答案:

答案 0 :(得分:1)

感谢Mark Setchell,我发现了发生了什么:

  • 在上次更新时,OSX停止接受没有shebang的脚本,并将我的应用标记为“Not x86_64”
  • 当我尝试修复它/用编译文件替换脚本时,标志仍然存在

所以解决方案是修复我的脚本并移动应用程序以重置启动服务数据库。 (存储绝对路径)