# How to Generate a UUID on Mac

URL: https://www.raycast.com/guides/how-to-generate-a-uuid-on-mac
Published: 2026-11-26
Updated: 2026-11-26
Description: 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.

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](https://www.raycast.com/jmaeso/uuid-generator) extension, which copies v4 and v7 UUIDs, ULIDs and TypeIDs straight to your clipboard.

| Method                     | Where you get it               | v4  | v7  | ULID / TypeID |
| -------------------------- | ------------------------------ | --- | --- | ------------- |
| UUID Generator for Raycast | Copied or pasted, from any app | Yes | Yes | Yes           |
| Raycast snippet            | Typed into any app             | Yes | No  | No            |
| `uuidgen` in Terminal      | Terminal                       | Yes | No  | No            |

## Generate UUIDs with Raycast | The quickest way

### [UUID Generator: v4 and v7 UUIDs, ULIDs and TypeIDs](https://www.raycast.com/jmaeso/uuid-generator)

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.](https://www.raycast.com/uploads/how-to-generate-a-uuid-on-mac/how-to-generate-a-uuid-on-mac.png)

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](https://manual.raycast.com/command-aliases-and-hotkeys). One keystroke, and a fresh UUID is on your clipboard.

### Type a UUID anywhere with a snippet

Raycast [Snippets](https://manual.raycast.com/snippets) are built in and free, and they support a `{uuid}` [placeholder](https://manual.raycast.com/dynamic-placeholders).

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](https://www.raycast.com/guides/how-to-set-up-text-expansion-on-mac).

## Use uuidgen in Terminal | Built 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:

```bash
# 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:

[Video: 102 Things You Can Do With Raycast 2.0](https://www.youtube.com/watch?v=G7_7F_FBqQE)

## 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.
