First, you create a public and private key (if you haven't done so already) on the machine from which you want to login:
ssh-keygen -t dsa
You only need to do this if there isn't already a ~/.ssh/id_dsa.pub
file.
On Linux, there's the ssh-copy-id
helper. On Mac, you need to copy the public key by hand:
Copy the generated public key to the target machine:
scp ~/.ssh/id_dsa.pub user@targetmachine:myPublicKey.pub
Login to the target machine:
ssh user@targetmachine
Append the public key to the authorized keys:
cat myPublicKey.pub >>.ssh/authorized_keys
You can now delete the copied key:
rm myPublicKey.pub
Done. You should now be able to login to your target machine without the need to enter a password.