Post

Replies

Boosts

Views

Activity

Reply to Using SMJobBless in modern Xcode
Although the SMJobBless sample code may not be needed for the OP's purpose, it's still an interesting question. I'm working on a GUI app that needs to get data by running a command line program that requires su. There are a number of problems with the Python script, mostly because it was presumably written for Python 2.7 and it doesn't seem possible to run Python 2.x on an M1 Mac running macOS 12: the #! line needs to be updated to /usr/bin/python3 (or to the path for your Homebrew install of a later version) the syntax for exception handling is different and needs to be updated issues with decoding UTF8 binary data into string objects the syntax of the output from the codesign utility has apparently changed so parsing that needs to be updated the plistlib functions are different, instead of passing a file to readPlist need to pass an open file object to load same for plistlib.writePlist(path) to plistlib.dump(file object) instead of using dict.has_key(key) use key in dict in isinstance check, use str instead of basestring replace dict.iteritems with dict.items use Python3 print statement syntax I've attached an updated file with the fixes needed to run with Python 3.8.9. SMJobBlessUtil.py Sadly, that doesn't solve the problem. I think this process is flawed, perhaps because the underlying codesign utility has changed. The idea of the script is you build the app and tool, run the script to get the code signatures for each, populate those code signatures into the corresponding plists (app references the tool's code signature and the tool references the app's signature). Then do a clean build with the updated plists and run the script to check that everything is right. The check always fails because changing the plists changes the app and the tool, so when it tries to verify the code signatures, they are different from what we got previously. This just can't converge! Is there some new method for GUI apps to be able to invoke a shell app that requires su?
May ’22