Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

up vote 7 down vote accepted

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.

share|improve this answer
    
Thanks so much. This will be very helpful. –  daviesgeek Aug 4 '11 at 22:11
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
    
Don't forget the : at the end! –  patrix 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

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.

share|improve this answer
    
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
rsync -Pvaze ssh source destination

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.