Skip to content

Instantly share code, notes, and snippets.

@iamjohnmills
Last active August 6, 2026 18:59
Show Gist options
  • Select an option

  • Save iamjohnmills/5368270e788216f02352dfa90a3b8426 to your computer and use it in GitHub Desktop.

Select an option

Save iamjohnmills/5368270e788216f02352dfa90a3b8426 to your computer and use it in GitHub Desktop.
Macos Generate Password in Terminal
echo -n "Enter number of uppercase letters (min 5): "; read count; [[ "$count" =~ ^[0-9]+$ ]] && (( count >= 5 )) || count=5; echo -n "Enter custom suffix: "; read suffix; pw="$(LC_ALL=C tr -dc 'A-Z' < /dev/urandom | head -c "$count")${suffix}"; echo "Generated Password: $pw"

sudo mv ~/path/to/passgen.sh /usr/local/bin/passgen

sudo chmod +x /usr/local/bin/passgen

passgen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment