Melotte Consulting

Journal entry

UUID and key generation with Alfred

A quick Alfred workflow for generating UUIDs plus hex or Base64 keys without dropping out of the task you are already in.

article Productivity 13 Sept 2025 6 min read

Why this entry exists

  • Useful notes belong on the main site when they help people make better use of systems in practice.
  • The goal is clearer workflows, better operational decisions, and fewer avoidable workarounds.
  • If a guide is worth writing, it should be easy to find and easy to return to later.

There are tasks that appear often enough to become irritating, but not often enough to become automatic. UUID and key generation sits in that category.

An Alfred workflow is a good fit because it keeps the task close to the keyboard and reduces the temptation to reach for a website, a scratch script, or a terminal detour every time.

Generating a UUID

The simplest version uses a keyword such as uuid and runs:

uuidgen | tr '[:upper:]' '[:lower:]'

That generates the UUID and normalises it to lowercase so the output is ready to paste straight into a config value, record, or code path.

Generating keys

For a 32-byte hex key:

openssl rand -hex 32

For a Base64 key:

openssl rand -base64 32

If you want one workflow to handle both formats, a simple argument switch works well:

case "$1" in
  hex|"")
    openssl rand -hex 32
    ;;
  base|base64)
    openssl rand -base64 32
    ;;
  *)
    echo "Unknown option: $1 (use 'hex' or 'base')"
    ;;
esac

That allows shortcuts like:

  • key or key hex
  • key base

Why this is useful

The value is not just speed. It is continuity. A tiny workflow like this removes just enough friction that repetitive utility tasks stop stealing attention from the real work.

This is the same reason shortcuts such as automating string encoding with Alfred become worth keeping around.

Need help applying something like this in a live workflow?

Reading a guide is often enough to clarify the pattern. If the workflow is already messy, brittle, or hard to trust, the better next step is usually to look at the operational problem directly.