One note: In the ssh-keygen -t rsa step you get asked to enter a pass phrase for your SSH key. Don't miss that. You will be asked by MacOS to enter it once you want to use the key.
ssh-keygen -t rsa
BTW: The need for public key authentication when using SSH is mentioned in the article above too.
More information about formatting options