Sample Header Ad - 728x90

How can I modify /System/Library/ScriptingDefinitions/CocoaStandard.sdef and have the changes persist?

1 vote
1 answer
243 views
I'm trying to modify /System/Library/ScriptingDefinitions/CocoaStandard.sdef. I want to do this because a lot of applications reference this file in their own scripting definitions, and I want to experiment with adding new stuff that will take effect in every application. Since scripting definition entries map directly to Cocoa objects and their methods, I figure this would be an effective way to mess with other applications' objects. I rebooted to Recovery OS and ran the following commands in a terminal: csrutil disable umount "/Volumes/Macintosh HD" mkdir /Volumes/mhd mount /dev/disk3s1 /Volumes/mhd cd /Volumes/mhd/System/Library/ScriptingDefinitions mv CocoaStandard.sdef CocoaStandard.sdef.original ln -s /Library/ScriptingDefinitions/CocoaStandard.sdef . reboot Note that I have already placed a copy of CocoaStandard.sdef in /Library/ScriptingDefinitions. The problem I'm running into is that, despite disabling System Integrity Protection, once I reboot into macOS, the changes I made in /System/Library/ScriptingDefinitions have somehow been reverted. There is no CocoaStandard.sdef.original, and CocoaStandard.sdef is once again a regular file rather than a symbolic link. How do I stop these changes from being reverted? Alternatively, if there is a better way to add custom scripting definitions to existing applications, that would work as well. (I tried directly adding entries to the .sdef inside a copy of the application, but then whenever I try to control that copy of the application using AppleScript, I get error -1728.)
Asked by Sparkette (217 rep)
Jun 28, 2022, 12:02 AM
Last activity: Jun 29, 2022, 11:40 PM