Macos Lion OSX上.pkg文件的自定义图标

Macos Lion OSX上.pkg文件的自定义图标,macos,icons,osx-lion,pkg-resources,Macos,Icons,Osx Lion,Pkg Resources,我已经使用PackageMaker创建了一个包,希望更改.pkg文件的默认图标。 在谷歌搜索之后,这里的seticon实用程序解决了除最新的Lion 10.7(内核11.0.0)之外的所有OSX设备的问题。默认图标已替换为灰色方形,不区分双击,看起来像断开的文件关联 另外两天,谷歌搜索给了我一些关于资源叉、SetFile(1)和一些其他有用的工作人员的知识,比如这个旧线程,但仍然没有运气 我正在尝试做一些类似的事情: target=pack.pkg icon_filename=“$(perl-e

我已经使用PackageMaker创建了一个包,希望更改.pkg文件的默认图标。 在谷歌搜索之后,这里的seticon实用程序解决了除最新的Lion 10.7(内核11.0.0)之外的所有OSX设备的问题。默认图标已替换为灰色方形,不区分双击,看起来像断开的文件关联

另外两天,谷歌搜索给了我一些关于资源叉、SetFile(1)和一些其他有用的工作人员的知识,比如这个旧线程,但仍然没有运气

我正在尝试做一些类似的事情:

target=pack.pkg

icon_filename=“$(perl-e'print”icon\r“)”

触摸“$target/.namedfork/rsrc/$icon\u filename”

cp“Icon.icns”“$target/.namedfork/rsrc/$Icon\u文件名”

/开发者/工具/设置文件-一个C“$target”

并获得: 生成Mac:pack.pkg/.namedfork/不是目录

我做错了什么?有人能告诉我Lion中资源分叉的区别吗?还有其他可编写脚本的解决方案吗


请注意,我完全是Mac电脑的新手,希望能为傻瓜提供详细的答案。

我终于找到了答案,如果有人需要,就把它放在这里。我使用了苹果的脚本:

set newIcon to (POSIX file "IconMac.icns") as alias
set theItem to (POSIX file "Installer.pkg") as alias

tell application "Preview"
activate
open newIcon
end tell
tell application "System Events"
tell process "Preview"
    keystroke "c" using command down
end tell
end tell
tell application "Preview" to quit

tell application "Finder"
set infoWindow to open information window of theItem
set infoWindowName to name of infoWindow
end tell

tell application "System Events"
tell application process "Finder"
    tell window infoWindowName
        keystroke tab
        delay 1
        keystroke "v" using command down
    end tell
end tell
end tell

tell application "Finder"
close infoWindow
end tell

这种方法在macOS 10.13.6上不起作用。通过将osascript添加到Settings/Privacy/A11Y应用程序中,我可以让它在Mojave上运行。@gamma该脚本在Mojave上对我不起作用。你必须从上面修改它吗?我从
com.apple.Preview/com.apple.Preview.PasteboardItems获得了被拒绝的权限
我想我保留了原样的脚本。但如果我没记错的话,我不得不将osascript命令添加到Preferences/Privacy/A11Y应用程序中。