Accessing the Raspberry Pi file system from SD card on a Mac

I’m sure we’ve all been there: the horrible moment when you realise you can no longer SSH into a headless pi and therefore you need to go and find a linux operating system in order to retrieve the last of your data before you wipe the SD card. Panic not, you don’t actually need a virtual machine or a whole different computer to access the files on your Pi you just need Fuse for OSX, and ext4fuse. PLEASE NOTE: this is READ ONLY.

First

If you don’t have Homebrew installed go and do that.

Install the packages

  • brew cask install osxfuse
  • restart
  • brew install ext4fuse

Find the disk and mount it

  • run diskutil list

This will give you a list of all the volumes currently attached to your computer. The one you’re looking for should be listed as external, physical and have a Linux partition listed. If you want to make extra sure then compare the listed size (in my case 31.9 for my 32 GB SD card). Here’s the listing for my disk:

Screenshot of the section of diskutil list showing the listing for my Raspberry Pi SD Card

The bit of this that we need to know is that the partition we’re trying to mount is disk3s2

  • Mount the disk using sudo ext4fuse /dev/<disk> /Volumes/rpi -o allow_other
  • the /Volumes/rpi bit of this command specifies the “mount point” for the disk, this is where your data will appear. So in this instance it will appear in the “Volumes” folder with all the other disks on my computer.
  • you cant perform this operation without sudo - you’ll get Permission denied
  • If you don’t add the -o allow_other the disk will only be readable by the root/sudo user (More information: Unable to open ext4 mounted partition on El Captain.
  • At this point you may be able to see the disk in Finder in the Volumes section. I couldn’t, so the simplest way I found to get it to show there was: open /Volumes/rpi or you could just use the command line to move your files around :)

When you’re finished

Don’t forget to unmount your disk: diskutil unmount /Volumes/rpi

Notes:

I am using macOS High Sierra version 10.13.2. As with all these things, if you’re using a different version of macOS your millage may vary.

With thanks to:

Jeff Geerling. This post is an updated version of his tutorial: Mount a Raspberry Pi SD card on a Mac (read-only) with osxfuse and ext4fuse.

Disclosure

As an Amazon Associate I earn from qualifying purchases.