3

Is there a way to send a file in Terminal from one Mac to another? If I have a file on Mac A and I want to send it to Mac B via Terminal on Mac A, how do I do this?

8

Enable "Remote Login" in the preferences of the target/remote mac. Then use

scp file user@remotehost:

with user being the short name of the remote user. You will be asked for the password of the user on remotehost.

If you want to avoid using passwords, you can set up ssh key pairs. See here for details.

6
  • 1
    You might want to look into rsync as well. It's an excellent tool for synchronizing files (preventing copying files that already exist on the destination, creating backups of updated files, etc).
    – EmmEff
    Aug 5 '11 at 3:50
  • It doesn't work. Here's what I did: scp ~/Desktop/test.txt matthewdavies@192.168.2.4. Is that right?
    – daviesgeek
    Aug 5 '11 at 15:12
  • 1
    Don't forget the : at the end!
    – nohillside
    Aug 5 '11 at 18:14
  • And you should enable "remote login" first. On the setting page you can also enable file-sharing by other protocols.
    – bdecaf
    Jan 15 '12 at 0:37
  • You should also notice that by providing these credential on a remote machine can login as the user you specify and get other files or even execute code. Or a faulty script could destroy a home directory. Use another protocol if you need any security.
    – bdecaf
    Jan 15 '12 at 0:47
1

I use Dropbox. If it's not huge files, that is. Just cp to your Dropbox folder on Mac 1 and Dropbox will sync it to Mac 2.

5
  • Not quite what I'm looking for. Dropbox is great, but...
    – daviesgeek
    Aug 4 '11 at 22:11
  • If you do use DropBox, make sure that the "Enable LAN sync" option is checked in DropBox Preferences. This will allow it to sync files over the LAN (as opposed to over the internet using DropBox servers) when able.
    – macaco
    Aug 5 '11 at 0:17
  • @macaco, ah, thanks. I've wondered what that checkbox was for.
    – PEZ
    Aug 5 '11 at 9:12
  • @daviesgeek, no, didn't think it was the answer you ware looking for. =) But I'm not lying. My use of scp has dropped significantly since I started using Dropbox. I have quite a few devices and most of my computers are laptops with the lid closed when not in use or maybe not in the house all the time. With Dropbox they will sync the file at first chance without me having to do anything.
    – PEZ
    Aug 5 '11 at 9:17
  • @PEZ Dropbox is great! Worst comes to worst, I'll use that, but what I want to do is place a file on a person's Mac in a specified directory.
    – daviesgeek
    Aug 5 '11 at 15:11
0
rsync -Pvaze ssh source destination

See man rsync for what the options mean and what other options are available.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .