3 Ways To Generate Random Passwords On a Mac

If you need to create a random password outside of Safari or another password manager, you can use a variety of techniques. You can use the Keychain Access app, some Terminal commands, or even make your own Automator action to generate one on demand.



Here are some of the pieces of code I use in the video:

cat /dev/urandom | LC_ALL=C tr -dc 'a-zA-Z0-9-_\$' | fold -w 8 | sed 1q
openssl rand -base64 6
date | md5
function run(input, parameters) {
	
	var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_";
	var pass = "";
	for (var i=0; i<8; i++) {
		pass += chars.charAt(Math.floor(Math.random()*chars.length));
	}

	return pass;
}

Comments: 6 Responses to “3 Ways To Generate Random Passwords On a Mac”

    Dale Ellis
    3 years ago

    I am a long time user of 1Password, but it is not always convenient. I don't think maintaing passwords in Safari is very secure. I appreciate now knowing alternate methods of creation. Thanks!

    3 years ago

    Dale: Why do you think passwords in Safari (Keychain) isn't secure? And what is not convenient about 1Password?

    Bob Gerard
    3 years ago

    I read the text version of your video hoping I would find the Terminal commands so I could cut and paste them into Terminal to try the out. I have learned the hard way that you better have the EXACT command when you use Terminal.
    Would you mind providing your readers/listeners with those commands & thank you.

    3 years ago

    Bob: Posted above. Thanks.

    David Wright
    3 years ago

    I opened keychain access for the first time while watching this video and was surprised to see many entries in the various windows. As I have never used keychain why would this be. Great and informative video as always. Thanks Gary

    3 years ago

    David: First, are you looking at only the passwords? Keychain stores lots of other things like certificates used by websites and apps for security, etc. But if you look at just the passwords you will see anything you have stored in Safari previously as Keychain is where they are stored.

Comments Closed.