Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can the 'summary service' be used on the command line in Mac OS X?

I have already tried piping, using the text file as an argument and sending the text file as stdin.

share|improve this question
What were the commands you used to pipe the test file into the summary service? – fideli Dec 12 '09 at 14:16
cat textfile | $(locate SummaryService | grep MacOS | tail -1) – user21154 Dec 13 '09 at 10:49
Doesn't work for me. – Studer Feb 10 '10 at 15:08

Try this AppleScript (say it's called summarize.scpt) and call from the command line using "osascript summarize.scpt <n>" where n is the number of desired summary sentences. This works on OS X 10.6.7. Just pipe the content in.

on run argv
  set stdin to do shell script "cat"
  set stdout to summarize stdin in (item 1 of argv)
end run

Alternately, you could use a one liner something like this:

osascript -e 'set stdin to do shell script "cat"' -e "set stdout to summarize stdin in $1"
share|improve this answer
second one didn't work, first one tool a little tweaking - but overall it is great to know the applescript dictionary includes the summarize command. – cwd Mar 22 '13 at 16:43

Unfortunately without writing an application (AppleScript ObjC, or even a true Obj-C app) to interact with NSService, no. Even then Summary Service is exclusively a GUI application so it would bring up the GUI.

However some Services (if an Automator Workflow) can be run manually on the command line by using automator on the command line.

share|improve this answer

There's also an open text summarization library called libots that includes a command line "ots" executable that one can pipe to. Summary Service and OTS seem to give different results, in brief testing I'm not sure which one I would give higher marks.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.