F-Script Injection in Mavericks

I continue to use F-Script occasionally to investigate how programs work internally. The framework itself has been updated to handle the changes in OS X Mavericks. However, the developer tools included with Xcode 5 swap out the gdb debugger for lldb, breaking the injection script I fixed for Lion again. After playing around with the automator action some more, here's what I came up with that works on Mavericks.

I switched back to using a temporary file to hold the lldb commands, because lldb is less tolerant of non-interactive shells. To use this: start automator, create a new "Service" file, add a "Run Applescript" block with the contents below, and save it as "Inject F-Script into application".

tell application "System Events"
	set pid to unix id of the first process whose frontmost is true
end tell

do shell script "
src=`mktemp -t fscript`

cat << EOF > $src
attach " & pid & "
p (char)[[NSBundle bundleWithPath:@\"/Library/Frameworks/FScript.framework\"] load]
p (void)[FScriptMenuItem insertInMainMenu]
detach
quit
EOF

lldb -s $src
rm $src" with administrator privileges

You may also like...

1 Response

  1. 14 August 2014

    […] This no longer works on Mavericks due to a debugger change. See this post for a new […]

Leave a Reply

Your email address will not be published. Required fields are marked *