Script Environment Variables

From Alfred v2.4, you'll find useful alfred_ variables in the script environment data, to help you get commonly required Alfred information from the user's settings.

Here is a list of the variables. Below, you'll also find an example of what you can expect this data to look like.


This is the location of the Alfred.alfredpreferences. If a user has synced their settings, this will allow you to find out where their settings are regardless of sync state.


From Alfred 2.4, non-synced preferences are moving out of the standard macOS preferences due to a Yosemite issue with prefs inheritance between Alfred and Alfred

Any local (Mac-specific) preferences are now stored within Alfred.alfredpreferences under …/preferences/local/[alfred_preferences_localhash]/ instead and use Alfred's own preferences framework.


Current theme used


If you're creating icons on the fly, this allows you to find out the colour of the theme background.


The colour of the selected result.


Find out what subtext mode the user has selected in the Appearance preferences.

Usability note: This is available so developers can tweak the result text based on the user's selected mode, but a workflow's result text should not be bloated unnecessarily based on this, as the main reason users generally hide the subtext is to make Alfred look cleaner.

alfred_version and alfred_version_build

Find out which version and build the user is currently running. This may be useful if your workflow depends on a particular Alfred version's features.


The bundle ID of the current running workflow

alfred_workflow_cache and alfred_workflow_data

These are the recommended locations for volatile and non-volatile workflow data:

Cache: ~/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/[bundle id]
Data: ~/Library/Application Support/Alfred/Workflow Data/[bundle id]

Note that these two will only be populated if your workflow has a bundle id set.


Name of the currently running workflow


Unique ID of the currently running workflow


Current workflow version


If the user currently has the debug panel open for this workflow. This variable is only set if the user is debugging, and is set to value 1.

Script Environment Variables Example

Here is an example of what you can expect from the data:

"alfred_preferences" = "/Users/Crayons/Dropbox/Alfred/Alfred.alfredpreferences";
"alfred_preferences_localhash" = adbd4f66bc3ae8493832af61a41ee609b20d8705;
"alfred_theme" = "alfred.theme.yosemite";
"alfred_theme_background" = "rgba(255,255,255,0.98)";
"alfred_theme_subtext" = 3;
"alfred_version" = "2.4";
"alfred_version_build" = 277;
"alfred_workflow_bundleid" = "com.alfredapp.david.googlesuggest";
"alfred_workflow_cache" = "/Users/Crayons/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/com.alfredapp.david.googlesuggest";
"alfred_workflow_data" = "/Users/Crayons/Library/Application Support/Alfred/Workflow Data/com.alfredapp.david.googlesuggest";
"alfred_workflow_name" = "Google Suggest";
"alfred_workflow_uid" = "user.workflow.B0AC54EC-601C-479A-9428-01F9FD732959";
"alfred_debug" = 1;

Latest Blog Post:

Alfred 5 Early Access is Now Available!

CacheFly Campaign Monitor

"Alfred" is a registered trademark of Running with Crayons Ltd. ©2022 Running with Crayons Ltd. All rights reserved.

Terms & Conditions, Privacy Policy, Cookies.