Screenshot of Terminal on macOS running the randomsn generator multiple times

Sometimes it’s helpful to be able to quickly generate a random serial number—one that is well-formed and won’t break a profile-based enrollment into a picky MDM server—without having to build a whole new VM.

I threw together a function that can be put into a bash profile that is used as an alias to quickly generate a serial number.

Just throw that in your profile (my go-to is .zshrc which I get to by entering nano .zshrc in a Terminal window) to add the above function as an alias to your profile. Open a new Terminal window and you can simply type randomsn to have a well-formed serial number generated for you.

Have a great weekend!