Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Could someone please briefly explain to me the difference between launchd and folder actions?

Do folder actions use launchd?

Is one more efficient than the other?

Is one more powerful than the other?

Is one used more over the other?

What is the difference between launch and launchctl?

Thanks!

share|improve this question

1 Answer 1

up vote 6 down vote accepted

Launchd and Folder Actions are two vastly different concepts.

Folder Actions

Folder Actions allow you to attach actions in the form of Apple Scripts folders which get triggered if the content of the folder changes. Typical use cases are e.g.

  • a folder to auto-upload photos to a website
  • removal of file attributes (e.g. the "downloaded" attribute)
  • triggering import into Evernote
  • etc.

launchd

launchd is a system-wide feature to run and control system-level background tasks. These can be either running all the time or get triggered by specific events (e.g. a connection request coming in over IP, a changing folder, a specific point in time etc.). OS X makes heavy use of this concept for all kind of things, have a look at the names in /Library/LaunchAgents and /Library/LaunchDaemons to get an idea of functionality depending on launchd.

Because launchd is a system service running in the background all the time it can't be accessed by the user directly. To send commands to launchd, the launchctl command is used.

Answers to specific questions

  • Do folder actions use launchd?

Most probably not. You can use launchd to do everything folder actions can do but at least on a level visibile to the user these are two different concepts

  • Is one more efficient than the other?

No difference here, both get triggered by OS X upon special conditions.

  • Is one more powerful than the other?

launchd is definitively more powerful.

  • Is one used more over the other?

In a newly installed system there already is a great number of active launchd scripts but no folder actions. Because the later must be explicitely activated and configured by the user, it's probably a safe guess that launchd is used more often.

share|improve this answer
2  
I believe that folder actions now run as a process under launchd and no longer run under Finder since Tiger –  Stu Wilson Sep 12 '12 at 6:04
    
Folder actions can also run Automator workflows. If you enable folder actions, two property lists are saved to ~/Library/LaunchAgents/. One starts Folder Action Dispatcher on login and another tells it to "tick" when folders that have folder actions are modified. There's no way to tell launchd to pass modified files as arguments to a program. –  ؘؘؘؘ Sep 12 '12 at 14:42

Your Answer

 
discard

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.