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.
If you don't have Homebrew installed go and do that.
Install the packages
This doesn't seem to be being updated use: https://osxfuse.github.io/
brew cask install osxfuse
brew install ext4fuse
Find the disk and mount it
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:
The bit of this that we need to know is that the partition we're trying to mount is
- Mount the disk using
sudo ext4fuse /dev/<disk> /Volumes/rpi -o allow_other
/Volumes/rpibit 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
- If you don't add the
-o allow_otherthe 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/rpior 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
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.