I'm trying to find a way to generate a unique system ID (HWID) without having to add any other gems first.

In other words, I want someone who's running a brand new version of Mac/Linux to be able to generate an ID, without having to install anything else.

The only ID methods I've found require additional gems to be installed, so that wont work.

有帮助吗?

解决方案

To follow Catnapper's comment, uuidgen is available on Linux systems, including Darwin.

Just make a call to it in your Ruby script:

irb(main):001:0> `uuidgen`
=> "613C66FE-F609-4389-8A70-A59D245070AE\n"
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top