How to Generate a UUID on Mac

Make a UUID on your Mac in a second, without a website: with the uuidgen command, a Raycast snippet, or a Raycast extension that also does v7 UUIDs, ULIDs and TypeIDs.

UPDATED

You need an ID for a test fixture, a database row or a config file, and you're about to search "uuid generator" and paste from a random website. Your Mac can do it faster.

The short answer: open Terminal and run uuidgen. It ships with macOS and prints a random UUID. To get one anywhere you type, create a Raycast snippet with the {uuid} placeholder, or install the free UUID Generator extension, which copies v4 and v7 UUIDs, ULIDs and TypeIDs straight to your clipboard.

MethodWhere you get itv4v7ULID / TypeID
UUID Generator for RaycastCopied or pasted, from any appYesYesYes
Raycast snippetTyped into any appYesNoNo
uuidgen in TerminalTerminalYesNoNo

Generate UUIDs with Raycast

UUID Generator: v4 and v7 UUIDs, ULIDs and TypeIDsInstall

UUID Generator is a free, open-source extension with more than 35,000 installs. Each command generates an ID and copies it to your clipboard, so you never leave the app you're working in.

View History in UUID Generator keeps every ID you've generated, ready to copy again.
View History in UUID Generator keeps every ID you've generated, ready to copy again.

Open Raycast and type one of these:

  • Generate UUIDs: random v4 UUIDs. Press Tab to type how many you want, and they're all copied at once.
  • Generate V7 UUIDs: time-ordered UUIDs that sort by creation time.
  • Generate V5 UUIDs: the same name always gives the same UUID, within a namespace you set in the preferences.
  • Generate ULIDs and Generate TypeIDs: sortable IDs, and TypeIDs with a prefix like user_.
  • Format UUID: adds the dashes back to a 32-character UUID.
  • View History: every ID you've generated, in case you need one again.

In the preferences, set Default Action to Paste to drop the ID straight into the front app instead of the clipboard, and turn on uppercase letters if your project uses them.

Pro tip: give Generate UUIDs a hotkey. One keystroke, and a fresh UUID is on your clipboard.

Type a UUID anywhere with a snippet

Raycast Snippets are built in and free, and they support a {uuid} placeholder.

  1. Open Raycast and run Create Snippet.
  2. Name it "UUID", and set the snippet text to {uuid | lowercase} (or just {uuid} for uppercase).
  3. Give it a keyword like !uuid.

Now type !uuid in any app and Raycast swaps it for a new UUID every time. More on that in our guide to text expansion on Mac.

Use uuidgen in Terminal

Every Mac comes with the uuidgen command.

  1. Open Terminal.
  2. Type uuidgen and press Return.

It prints a random (version 4) UUID in uppercase, like E621E1F8-C36C-495A-93FC-0C247A3E6E5F. A few variations:

# Lowercase uuidgen | tr '[:upper:]' '[:lower:]' # Copy to the clipboard, without the trailing newline uuidgen | tr -d '\n' | pbcopy # Five at once for i in {1..5}; do uuidgen; done

uuidgen only does v4. For v7 UUIDs, use a library in your language or the Raycast extension above.

Which UUID version should I use?

  • v4 is random. Use it when you just need a unique value and order doesn't matter.
  • v7 starts with a timestamp, so new IDs sort after older ones. It's the better choice for database primary keys because it keeps indexes tidy. v7 was standardized in RFC 9562 in 2024.
  • v5 is derived from a name and a namespace, so the same input always gives the same ID. Use it when you need stable IDs for things like URLs.

New to Raycast?

Here's a quick tour of what else it can do, in under seven minutes:

Frequently Asked Questions

Does macOS have a built-in UUID generator?

Yes. The uuidgen command ships with macOS. Run it in Terminal and it prints a random version 4 UUID, in uppercase.

How do I generate a lowercase UUID on Mac?

Pipe uuidgen through tr: uuidgen | tr '[:upper:]' '[:lower:]'. In a Raycast snippet, use {uuid | lowercase}.

What's the difference between UUID v4 and v7?

A v4 UUID is fully random. A v7 UUID starts with a timestamp, so new IDs sort after older ones. That makes v7 a better fit for database primary keys. Both are defined in RFC 9562.

Can two UUIDs ever be the same?

In theory, yes. In practice, a random v4 UUID has 122 random bits, so the chance of a collision is too small to worry about for almost any application.

Is a GUID the same as a UUID?

Yes. GUID is Microsoft's name for the same 128-bit identifier. A UUID generated on a Mac works anywhere a GUID is expected.

Generate UUIDs, ULIDs and TypeIDs from your keyboard. Try Raycast for free.

Download