After upgrading to OS X Yosemite, you might find your system running rather slowly, even when there are no obvious reasons for it, such as a program you have open that is performing some computationally intensive task. Upon investigating this, you might resort to opening Apple’s Activity Monitor program to see what is running in the background, and find a process called Folder Actions Dispatcher running and using between 80 to 100 percent of your CPU.
If this happens, then it is likely because at some point you or a program you installed set up folder actions on your Mac. These are a rather unused feature of OS X, but are quite useful for monitoring changes to folders for the sake of automating tasks using AppleScript and Automator, including a security approach I recommend to keep tabs on various system folders that malware developers use for storing launcher scripts to keep their malware running in the background.
Fixing this problem will require Apple’s engineers to issue an update for Folder Actions; however, until then, you can overcome it by disabling Folder Actions on your Mac:
- Open the Script Editor utility in your Applications > Utilities folder
- Go to the Script Editor’s Preferences (press Command-comma in the program)
- Ensure “Show Script menu in menu bar” is enabled
- Go to the script menu, which looks like a small scroll of paper
- Select Folder Actions > Configure Folder Actions
- Uncheck the box in the window that appears for “Enable Folder Actions”
An alternative to the last two steps is to simply select the Disable Folder Actions script that should be in the same Folder Actions submenu as the configuration utility. With either of these two done, Folder Actions should be disabled and you should see your CPU usage drop from the dispatcher process.
(UPDATE: MacIssues reader “Mike” wrote in with a suggestion to try simply toggling Folder Actions off and then back on again using the options in the Folder Actions menu, to see if this fixes the problem and allows you to continue using your configured Folder Actions.)
Unfortunately, with this feature disabled, you will not be able to automate tasks as easily. One alternative to folder actions is to set up launch daemon scripts, which have options to set up watch paths that will trigger the launching of programs and alternative scripts; however, this does require you use Terminal commands and editors to create XML property list launch agent files.
If you are familiar with these, then you can use the following property list template to launch a given program or script whenever the folders specified in the script are changed (I will outline how to do this in-depth in a follow-up article):
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>FolderActions</string> <key>ProgramArguments</key> <array> <string>/path/to/script/or/program</string> </array> <key>WatchPaths</key> <array> <string>/Full/Path/to/first/monitored/folder</string> <string>/Full/Path/to/second/monitored/folder</string> <string>/Full/Path/to/third/monitored/folder</string> </array> </dict> </plist>
Using TextEdit to save this plist structure in a plain text (not rich text) document named “folderactions.plist,” and placed in your username/Library/LaunchAgents folder (logging out and back in is an easy way to activate the agent) will watch the paths listed in the WatchPaths section for any changes, and then invoke the first ProgramArguments string as a command. This program can be an application, an applescript, an Automator Workflow, shell script, or other utility, each of which may take slightly different syntax here for running, but all of which can be invoked in the ProgramArguments section.
The main problem with using this approach is that filesystem events may not always be complete when WatchPaths is triggered, so the launch agent may run even when small updates are made to folders, or it may miss some updates altogether; however, it is the best alternative to a buggy Folder Actions in Yosemite.