To squash/unsquash a Linux squashfs filesystem on a Mac, you can build the squashfs tools.
A few modifications of the source are required for OS X:
- The FNM_EXTMATCH flag doesn’t exist in the fnmatch library on OS X. This just means that you can’t use glob patterns with mksquashfs.
- The constants to figure out how many CPUs the machine has are in the sysctl header instead of the sysinfo header.
- The C99 compiler has different semantics for the inline keyword, so inline functions should also be static.
- Instead of llistxattr(), lgetxattr(), lsetxattr(), Apple uses a XATTR_NOFOLLOW flag on the non-link equivalent functions.
Here’s a complete download-and-build recipe:
The filesystem you’re unsquashing probably has root-owned files in it, so you’ll have to use sudo to run unsquashfs as root.
The limit of open files is somewhat low on a Mac, so you’ll get a bunch of errors if you try to unsquash a whole filesystem:
write_file: failed to create file squashfs-root/path/to/file, because Too many open files
Just change the limit in the shell before running unsquashfs:
There seems to be a bug when drawing the progress bar that causes Floating point exception, which you can workaround by using the -n flag.