uuidgen - macOS


uuidgen is a macOS command-line tool that generates universally unique identifiers (UUIDs). It is primarily used for creating unique identifiers for system components, files, and other entities.


uuidgen [options]


  • -r: Generate a random UUID (default)
  • -t: Generate a UUID based on the current time
  • -u: Generate a UUID based on the user’s identity


Generate a random UUID:


Generate a time-based UUID:

uuidgen -t

Generate a UUID based on user identity:

uuidgen -u

Common Issues

  • Empty output: Make sure the command is invoked with the correct syntax and options.
  • Invalid UUID format: Check if the generated UUID follows the standard format (e.g., xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).


uuidgen can be combined with other commands for advanced tasks:

Create a UUID-named file:

uuidgen | xargs touch

Pass UUID as argument:

python3 script.py $(uuidgen)