Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

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

I'm not inviting people to hate on AppleScript in general; I'm just wondering if what makes AppleScript useful can instead be used by other general-purpose scripting languages. I.e., Lion & Mac Apps probably give AppleScript hooks & APIs—could any language use those? Or is AppleScript in its own special category?

Context: I'm learning about Unix and how it underlies OS X, and trying to become aware about opportunities and strategies for automation & abstraction. Aaaand I already feel like my brain is leaking, so if I have to add more to my plate I try to do so sparingly.

share|improve this question
They're just tools. Unless you're building a house, a framing hammer is a pretty useless thing to worry about. When you're learning - focus more on the task at hand. Since you're brain is leaking, I'd leave the philosophy for another day and do come back with a specific question. We can make better progress on that front rather than worrying about gorillas fighting sharks. – bmike Aug 31 '11 at 5:00

In terms of general purpose Unix scripting, many languages like bash, perl, python, or ruby are more capable than AppleScript. But AppleScript has a special role in MacOS with great native support for Mac specific things, particularly related to the GUI.

There are bindings between other scripting language and MacOS events. For instance, see the MacPython OSA Modules or Apple's Ruby and Python for Mac OS X. In general I'd consider these efforts second class citizens; they may work and be a good choice but it will be a bit of an awkward fit.

share|improve this answer
Since the Ruby and Python page at Apple hasn't been updated since 2007, they sure are second class citizens. :-) – lpacheco Aug 31 '11 at 9:44

My answer would be: yes

Applescript is a horrible anachronism from System 7 and in all my years of Mac use and development I could never bring myself to write a single line of it.

OSA is a framework supported by Apple which allows you do access anything normally done over Applescript. Whether it's first or second class, only Apple knows. Java was touted by Apple as a first class citizen for Cocoa until Apple killed it. Python and Ruby are different though because they are modern languages while Applescript is an ancient mess and Apple knows it.

Speaking specifically from a Ruby background, you have a few options:

  1. rb-appscript - rather outdated
  2. RubyOSA
  3. ScriptingBridge for Cocoa. Also a good tutorial on it with MacRuby at Ars Technica.

I've used these quite extensively in the past years and they do the job very nicely. Similar equivalents should exist for Python.

share|improve this answer

AppleScript is in its own special category, as it is developed by Apple and has its own built-in mechanisms for interacting with the Apple Events system in OS X. I'm not aware of any such built-in support in the other scripting languages you mentioned.

In order to add that support into your scripts, you could use an event bridge such as appscript to allow you to leverage AppleScript hooks in apps from Ruby or Python. I've never used it myself, so your mileage may vary.

share|improve this answer

The design philosophies of AppleScript and command-line scripting languages are two very different things. They both aim at getting things done, but go about it in very different ways.

AppleScript is meant to help you automate common high level GUI based tasks, so you don't have to click this and type that over and over again.

Command-line scripts usually offer more flexibility and power than AppleScript (unless you really know your AS that is!) letting you dig deep into the guts of Mac OS X's unix-like APIs.

To summarize:

  • AppleScript: Automate your GUI-based software.
  • Command-line scripts: Do most other tasks.
  • No, they can't replace AppleScript because AS is closer to the GUI for many tasks (it's a breeze to automate mounting a remote volume in AppleScript, I would not want to try it in bash or perl).
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.