In rare occasions (or not so rare, depending on what you are doing) you will find yourself needing to generate a UUID.

Here is how you generate one using your terminal (UNIX and UNIX like systems).

uuidgen

Notes

The uuidgen tool generates a lowercase string on Linux and uppercase string on MacOS.

The UUID specs indicates that uuids are case insensitive so this difference shouldn't matter. But if you want to generate lowercase uuid on MacOS you can combine the uuidgen tool with tr like so

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