非常感謝你的提醒。事實上這個畫面就可以證明,我使用一台Mac mini上安裝全新的macOS High Sierra 10.13.6來測試sips。為了避免從10.11.6舊版升級,可能會有其他的問題,所以我是重新格式化硬碟,再重新安裝10.13.6的方式。

現在sips最大的問題就是,在macOS 10.11.6只能使用方法A。在macOS 10.13.6只能使用方法B。
如果反過來,在macOS 10.11.6執行方法B的程式碼,會在Apache的error_log產生這樣的錯誤訊息:
execution error: An error of type -10810 has occurred
搜尋一下Google發現也有別人遇到相同的問題,例如...
The Infamous OS X execution error: An error of type -10810 has occurred. (-10810)
AppleScript: execution error -10810 when launching certain applications from shebang'ed scripts
有人說這個Bug已經在macOS 10.10.3修正了...
Update: The bug has been fixed in OSX 10.10.3.
The behavior observed is a bug in OSX 10.10 still unresolved as of OSX 10.10.2 (as of 10 Mar 2015):
Anyone interested in getting this fixed should file their own bug at bugreport.apple.com.
It applies to executable scripts that are directly or indirectly passed to osascript - whether:
- explicitly (osascript launch-app)
- or implicitly, via the shebang line, by direct invocation (./launch-app)
The specific form of the shebang line is irrelevant (whether #!/usr/bin/osascript or #!/usr/bin/env osascript or #!/usr/bin/env osascript -l JavaScript or ...), what matters is whether the file has the executable bit (permission) set (e.g., via chmod +x).
Workarounds:
-
As suggested by the OP, feed the file to osascript via stdin: osascript < launch-app
- This has side effects; for instance, name of me will report msng instead of the name of the script.
-
Remove the executable bit from the script and invoke it explicitly with osascript:
- chmod -x launch-app # a one-time operation
- osascript launch-app # with the executable bit unset, this should work
但是,事實上OSX 10.10.3根本沒有修正,或是沒有完全修正好!我在macOS 10.11.6上面仍然會看到 type -10810 的錯誤訊息!
所以我主要是擔心在macOS 10.14可能會遇到新的問題,最糟糕的情況是方法A、方法B都不能使用!如果我一時找不到解決辦法,只好從10.11升級到10.13。至少這個版本可以使用方法B來支援Canon EOS 5D Mark IV等新的相機的RAW檔。