macOS Password Generator in BASH

Because feeble passwords are weak.

Justin Dorfman
1 min readMay 14, 2013
Official Bash Logo: http://j.mp/bash-logo

I love strong passwords. TIL an easy way to create a strong, secure password and have it copied to your clipboard.

Install pwgen (use Homebrew)

$ brew install pwgen

Add the following to your ~/.bash_profile

genpasswd() { pwgen -Bs $1 1 |pbcopy |pbpaste; echo “Has been copied to clipboard”
}

Reload your profile

$ source ~/.bash_profile

Run it

$ genpasswd 20
Eq7ZqEuiyHxscL
Has been copied to clipboard

Not on OS X? Try g20: $ npm i -g g20

Thank you for reading. If you❤️ this, click the 👏 below.

--

--