I use it all the time for ssh, sftp or rsync.
In Mac, please run the following command to install ssh-copy-id.
ssh-keygen and then type Enter for three times to generate id_rsa and id_rsa.pub
ssh-copy-id -i ~/.ssh/id_rsa.pub user@remote_server_address
input the login password.
try ssh user@remote_server_address to see if it works.
I have used cat ~/.ssh/id_rsa.pub | ssh user@remote_server_address ‘cat >> .ssh/authorized_keys’ before. Sometimes it doesn’t work, but ssh-copy-id works well.