تخطَّ إلى المحتوى

Alfred Cheat Sheet

Overview

Alfred is a productivity application for macOS that enhances your workflow with a powerful launcher, custom hotkeys, text expansion, clipboard history, and an extensive workflow automation system. It can be used as a Spotlight replacement with significantly more capability, offering web searches, calculator, dictionary, file navigation, and system commands from a single search bar.

Alfred’s Powerpack (paid license) unlocks the full workflow system, clipboard history, snippets, and more. Workflows are Alfred’s killer feature, allowing complex multi-step automations triggered by keywords, hotkeys, or file actions. There is a large community sharing workflows for everything from password management to API integrations.

Installation

# Install via Homebrew
brew install --cask alfred

# Or download from https://www.alfredapp.com

Initial Setup

  1. Launch Alfred and set the global hotkey (default: Opt+Space)
  2. Optionally disable Spotlight: System Settings > Keyboard > Keyboard Shortcuts > Spotlight
  3. Grant required permissions: System Settings > Privacy & Security > Accessibility
  4. Install the Powerpack license for advanced features

Core Features

Keyboard Shortcuts

ShortcutAction
Opt+SpaceOpen Alfred
EnterExecute selected action
Cmd+EnterReveal file in Finder
Opt+EnterSearch for item in files
Ctrl+EnterAct on item (show actions)
TabAutocomplete / navigate into folder
Cmd+CCopy selected item
Cmd+LShow large type
Cmd+,Open Alfred Preferences

Default Search Commands

PrefixActionExample
(none)Search apps, files, bookmarksslack
openOpen file/folderopen ~/Documents
findSearch file systemfind report.pdf
inSearch file contentsin quarterly report
defineDictionary lookupdefine ephemeral
spellCheck spellingspell recieve
=Calculator= 42 * 3.14

Web Searches

KeywordAction
google {query}Google search
wiki {query}Wikipedia search
amazon {query}Amazon search
maps {query}Google Maps search
images {query}Google Images search
yt {query}YouTube search

System Commands

CommandAction
lockLock the screen
sleepPut Mac to sleep
restartRestart the Mac
shutdownShut down the Mac
trashOpen Trash
emptytrashEmpty the Trash
screensaverStart screen saver
hide {app}Hide an application
quit {app}Quit an application
forcequit {app}Force quit an application
ejectEject mounted volumes
volup / voldownVolume up / down
muteMute audio

Configuration

Preferences

General:
  - Hotkey: Set global shortcut
  - Where: Country for localized searches
  - Startup: Launch at login

Features:
  - Default Results: Configure what appears in search
  - File Search: Set search scope and types
  - Web Search: Custom search engines
  - Calculator: Enable/disable
  - Dictionary: Configure dictionary sources
  - Contacts: Enable contact search

Appearance:
  - Theme: Choose from built-in or custom themes
  - Options: Result count, font size, blur

Custom Web Searches

# Add custom search engines in Preferences > Features > Web Search

Title: Stack Overflow
Keyword: so
URL: https://stackoverflow.com/search?q={query}

Title: GitHub
Keyword: gh
URL: https://github.com/search?q={query}

Title: npm
Keyword: npm
URL: https://www.npmjs.com/search?q={query}

Title: MDN Docs
Keyword: mdn
URL: https://developer.mozilla.org/en-US/search?q={query}

Title: Docker Hub
Keyword: docker
URL: https://hub.docker.com/search?q={query}

Clipboard History (Powerpack)

# Enable in Preferences > Features > Clipboard History
- Set history duration (24 hours, 7 days, 1 month, 3 months)
- Access via hotkey (e.g., Cmd+Opt+C)
- Search through clipboard history
- Supports text, images, and file references
- Merge multiple clipboard items
- Clear sensitive items
- Pin frequently used items

Snippets (Powerpack)

# Create snippets in Preferences > Features > Snippets

Name: Email signature
Keyword: ;sig
Content: Best regards,
         Alice Smith
         Senior Developer

# Dynamic placeholders:
{date}              — current date
{time}              — current time
{clipboard}         — clipboard contents
{cursor}            — cursor position
{date:medium}       — medium format date
{date:YYYY-MM-DD}   — custom date format
{random:UUID}       — random UUID
{random:3:9}        — random number 3-9

Advanced Usage

Workflows (Powerpack)

Workflows are Alfred’s most powerful feature. They chain together triggers, inputs, actions, and outputs.

Workflow Components:

TypeExamples
TriggersKeyword, Hotkey, File Action, Snippet, External
InputsScript Filter, File Filter, Keyword
ActionsOpen File, Open URL, Run Script, System Command
UtilitiesConditional, Delay, Filter, Transform, JSON
OutputsNotification, Copy to Clipboard, Play Sound, Large Type

Script Filter (JSON Output)

#!/bin/bash
# A script filter that returns JSON results

cat << 'EOF'
{
  "items": [
    {
      "title": "First Result",
      "subtitle": "Description of first result",
      "arg": "value-to-pass-along",
      "icon": { "path": "icon.png" },
      "mods": {
        "cmd": {
          "subtitle": "Hold Cmd for alternative action",
          "arg": "alternative-value"
        }
      }
    },
    {
      "title": "Second Result",
      "subtitle": "Another result",
      "arg": "second-value",
      "valid": true
    }
  ]
}
EOF

Python Workflow Script

#!/usr/bin/env python3
import json
import sys

query = sys.argv[1] if len(sys.argv) > 1 else ""

items = [
    {
        "title": f"Search for: {query}",
        "subtitle": "Press Enter to search",
        "arg": query,
        "icon": {"path": "icon.png"},
    }
]

print(json.dumps({"items": items}))
WorkflowDescription
DashSearch API documentation
1PasswordSearch and fill passwords
Kill ProcessFind and kill processes
ColorsColor conversion and picker
Encode/DecodeBase64, URL, HTML encoding
Lorem IpsumGenerate placeholder text
IP AddressShow local and public IP
Emoji SearchFind and copy emojis
HomebrewSearch and install brew packages
SSH ConnectionsQuick SSH to saved hosts

Workflow Environment Variables

# Access workflow variables in scripts
echo "$query"           # The user's input
echo "$alfred_version"  # Alfred version
echo "$alfred_workflow_data"    # Workflow data directory
echo "$alfred_workflow_cache"   # Workflow cache directory
echo "$alfred_preferences"      # Alfred preferences path

File Actions

# Create custom file actions in workflows:
1. Add a "File Action" trigger
2. Set accepted file types (e.g., public.image, public.text)
3. Connect to actions (e.g., Run Script, Open URL)
4. Select file in Alfred > press right arrow > choose your action

Troubleshooting

IssueSolution
Alfred not finding appsRebuild macOS index: sudo mdutil -E / or set search scope in Preferences
Permissions not workingGrant Accessibility and Full Disk Access in System Settings > Privacy
Clipboard history emptyEnable in Preferences > Features > Clipboard History; set retention period
Workflow not triggeringCheck keyword spelling; verify connections between nodes in editor
Scripts failingCheck script permissions (chmod +x); test scripts in Terminal first
Hotkey conflictChange in Preferences > Features > Hotkey; check other apps for conflicts
Search results staleRebuild Alfred cache: reload command; clear file cache in Preferences
Snippets not expandingEnable auto-expansion in Preferences; check keyword prefix
Slow resultsLimit search scope; exclude large directories like node_modules