Add instructions for macOS. #70

Merged
dboreham merged 10 commits from telackey/osx into main 2023-10-18 20:06:28 +00:00
Showing only changes of commit ade3e94f4a - Show all commits

View File

@ -7,7 +7,8 @@ if [[ -n "$CERC_SCRIPT_DEBUG" ]]; then
fi
secure_password() {
# extra bytes so that even if we delete some chars we will still have plenty
# use openssl as the source, because it behaves similarly on both linux and macos
# we generate extra bytes so that even if tr deletes some chars we will still have plenty
openssl rand -base64 32 | tr -d '\/+=' | head -c 10 && echo
telackey marked this conversation as resolved Outdated

Should also change the comment in line 9 since it no longer pertains?
(but probably this change should be in a separate PR?)

Should also change the comment in line 9 since it no longer pertains? (but probably this change should be in a separate PR?)

Done

Done

Was the change necessary because macos doesn't have /dev/urandom ?

Was the change necessary because macos doesn't have `/dev/urandom` ?

No, it has /dev/urandom, but tr is not able to consume it without explicitly setting LC_CTYPE=C, otherwise it complains about invalid input. Once you get past that hurdle, the options do not behave the same way, and '-dc' ends up selecting the complement of the set rather than deleting it, so you end up with only unprintable characters.

No, it has /dev/urandom, but `tr` is not able to consume it without explicitly setting `LC_CTYPE=C`, otherwise it complains about invalid input. Once you get past that hurdle, the options do not behave the same way, and '-dc' ends up selecting the complement of the set rather than deleting it, so you end up with only unprintable characters.

Might be worthwhile adding a comment saying openssl used because it's available and works on both macos and Linux?

Might be worthwhile adding a comment saying openssl used because it's available and works on both macos and Linux?

Added

Added
}