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!
Best Answer
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.
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
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
No difference here, both get triggered by OS X upon special conditions.
launchd is definitively more powerful.
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.