3

I have several .py and .jpg files on my Raspberry Pi that I'd like to copy to my Mac. Is there anyway to do it directly from the SD card or with a USB stick?

I prefer to not download any additional software.

I've tried similar steps to those indicated here. I've also tried to connect the SD card directly to the computer but I can't seem to find the files on it.

red_kb
  • 93
  • 1
  • 6
  • By default, files you write will likely be put somewhere in /home/pi. While on the Pi, who are you logged in as, and where do the files appear? Go into that directory, and do a pwd on the command line. Put the SD into the Mac, browse to the SD card, then follow the path down to where pwd showed you where the files are. – stevieb Feb 22 '17 at 00:40
  • @stevieb I have moved the files to the home directory on the pi, but when I view the sd card on my other computer, I only see recovery and boot. – red_kb Feb 22 '17 at 00:48
  • Are you using a Linux/MacOs PC or a Windoze one? The latter cannot normally see beyond the first (VFAT/FAT32) partition (where the bits you CAN see reside) on an RPi SD Card because the others are not usually partition types (a 2-digit hex code) that the latter OS can understand - they also use file-systems such as ext2 or the journalled successors ext3 or 4 that *nix systems use. There ARE tools/drivers that can be installed on 'Doze PC that will at least give read-only access to the other parts. – SlySven Feb 25 '17 at 21:14
  • I have heard that the RPi ___Zero___ might support USB OnTheGo but whether it does that out the box is unclear...! – SlySven Feb 25 '17 at 21:15

2 Answers2

6

You have two easy options here.

You can simply copy the files from the Pi to /boot and then copy them from the SD card.


Another option is to set the Pi to emulate a USB Ethernet stick, which will allow you to copy the files via SSH. Following the instructions at https://gist.github.com/gbaman/975e2db164b3ca2b51ae11e45e8fd40a. All of these instructions can be performed from the computer, except for #1.

  1. Enable SSH using raspi-config.
  2. In config.txt, add dtoverlay=dwc2 to the end.
  3. Add modules-load=dwc2,g_ether to the end of cmdline.txt, separating it from previous commands with a space. Reboot the Pi, or shut it down and power it using the next step.
  4. Plug the the Pi into the computer using the USB (not power) port. The Pi will appear as a USB Ethernet device.
  5. Using SCP as described in https://stackoverflow.com/a/3710966, run scp raspberry@your.ip.address:/home/pi/file ~/Documents/file. You can find your Pi's IP address in the Network panel of System Preferences. Also, you should replace raspberry with your username.
lights0123
  • 426
  • 2
  • 6
  • I tried to move the files to the boot folder, but it said I did not have permission to do so. I was in a hurry, so I did not have an opportunity to try the second option but I was able to transfer the files directly with a usb drive. Thank you for your time and help. – red_kb Feb 25 '17 at 19:49
  • @ERN you did not use sudo, and therefore did not have the permission to copy it. If you want to use that option in the future, run sudo cp ~/file /boot/file – lights0123 Feb 25 '17 at 19:53
2

If you have the USB adapter for your pi-zero you can simply connect the usb stick and copy the file to it (it should be mounted to something like /dev/sdb1). just type

mount

to check the mount point AFTER having connected the USB stick. Otherwise, you can connect directly the microsd to a linux computer (MacOS doesn't support ext3, so you will not able to mount the drive unless you install something like https://osxfuse.github.io/)

Steve Robillard
  • 34,687
  • 17
  • 103
  • 109
Giuseppe B
  • 146
  • 1
  • A friend actually recommended that I do this, and as soon as I plugged the drive in, the pi recognised it, and I did not have to mount it to transfer the files. However I had to reformat the drive as fat. – red_kb Feb 25 '17 at 19:51