The following command,

osascript -e 'tell app "terminal" to do script ("idevicesyslog -u UUID | tee 'ios_syslog.txt'")'

(where UUID is the hard-coded device id) works fine in Terminal. It opens a new window and runs the script, but when I pass it in via a .Net CORE api call I get the above syntax error.

Even just osascript -e 'tell app "terminal" to do script ("idevicesyslog")' fails with the same error.

Any thoughts?

  • Try osascript -e 'tell application "Terminal" to do shell script "..."' and where you're using single-quotes in 'ios_syslog.txt' you might have to escape them, e.g. \'ios_syslog.txt\' and I can't test because I don't have the same environment as you do. Commented Aug 30, 2016 at 1:39
  • Thanks for the suggestion but that did not help. In the end I used a workaround as shown above
    – MidiGlitch
    Commented Aug 31, 2016 at 17:19
  • The workaround should be an answer not an edit to the question (and if you need no more you could accept it)
    – mmmmmm
    Commented Aug 31, 2016 at 18:23

1 Answer 1


WORK AROUND: I solved the issue by putting the above in an Applescript and calling the script from C#. Meant having to add a non .Net file to the project which can only be edited on a Mac (so far as I know). Script is:

on run argv
    tell application "terminal"
        do script ("idevicesyslog -u " & item of argv & " | tee '" & item 2 of argv & "'")
    end tell
end run

The script was called by using System.Diagnostics.Process and passing in osascript.exe and the two arguments into the ProcessStartInfo constructor.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .