copy ssh key to a file code example
Example 1: copy public key mac
pbcopy < ~/.ssh/id_rsa.pub
Example 2: copy ssh key to remote server
ssh-copy-id -i ~/.ssh/mykey.pub user@host
pbcopy < ~/.ssh/id_rsa.pub
ssh-copy-id -i ~/.ssh/mykey.pub user@host