Accessing ext4 filesystems on macOS can be tricky due to a lack of built-in support for this Linux filesystem. But for Mac OS Ventura users, there's a neat workaround to achieve this via ext4fuse, even if the installation throws up an error like: "ext4fuse: Linux is required for this software."
Prerequisites
Ensure you have Homebrew installed and updated on your system to facilitate the installation of other necessary tools. If not, you can install it using the following terminal command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
First, create a custom ext4fuse formula that you'll use for Homebrew. Open a text editor and save the following script as `ext4fuse.rb`:
class MacFuseRequirement < Requirement
fatal true
satisfy(build_env: false) { self.class.binary_mac_fuse_installed? }
def self.binary_mac_fuse_installed?
File.exist?("/usr/local/include/fuse/fuse.h") &&
!File.symlink?("/usr/local/include/fuse")
end
env do
ENV.append_path "PKG_CONFIG_PATH", HOMEBREW_LIBRARY/"Homebrew/os/mac/pkgconfig/fuse"
unless HOMEBREW_PREFIX.to_s == "/usr/local"
ENV.append_path "HOMEBREW_LIBRARY_PATHS", "/usr/local/lib"
ENV.append_path "HOMEBREW_INCLUDE_PATHS", "/usr/local/include/fuse"
end
end
def message
"macFUSE is required. Please run `brew install --cask macfuse` first."
end
end
class Ext4fuse < Formula
desc "Read-only implementation of ext4 for FUSE"
homepage "https://github.com/gerard/ext4fuse"
url "https://github.com/gerard/ext4fuse/archive/v0.1.3.tar.gz"
sha256 "550f1e152c4de7d4ea517ee1c708f57bfebb0856281c508511419db45aa3ca9f"
license "GPL-2.0"
head "https://github.com/gerard/ext4fuse.git"
bottle do
sha256 cellar: :any, catalina: "446dde5e84b058966ead0cde5e38e9411f465732527f6decfa1c0dcdbd4abbef"
sha256 cellar: :any, mojave: "88c4918bf5218f99295e539fe4499152edb3b60b6659e44ddd68b22359f512ae"
sha256 cellar: :any, high_sierra: "fc69c8993afd0ffc16a73c9c036ca8f83c77ac2a19b3237f76f9ccee8b30bbc9"
sha256 cellar: :any, sierra: "fe8bbe7cd5362f00ff06ef750926bf349d60563c20b0ecf212778631c8912ba2"
sha256 cellar: :any, el_capitan: "291047c821b7b205d85be853fb005510c6ab01bd4c2a2193c192299b6f049d35"
sha256 cellar: :any, yosemite: "b11f564b7e7c08af0b0a3e9854973d39809bf2d8a56014f4882772b2f7307ac1"
end
depends_on "pkg-config" => :build
on_macos do
depends_on MacFuseRequirement => :build
end
on_linux do
depends_on "libfuse"
end
def install
system "make"
bin.install "ext4fuse"
end
end
Steps to Install ext4fuse on Mac OS Ventura 13.6
1. Install macFUSE:
MacFUSE is essential for ext4fuse, run the following command to install it:
brew install --cask macfuse
2. Install ext4fuse:
Use the custom formula created earlier to install ext4fuse:
brew install --formula --build-from-source ./ext4fuse.rb
Note: Ensure you run this command from the directory where `ext4fuse.rb` is located.
3. Remove osxfuse (if applicable):
If you have osxfuse installed, it might be prudent to remove it since it has been renamed and superseded by macFUSE:
brew rm --cask osxfuse
4. Read Disk
If you've successfully installed `ext4fuse` by following the previous instructions and you want to mount an ext4 filesystem, you would generally use a command like what you've provided. However, ensure that `/dev/disk2s1` represents the correct path to your ext4 partition. Also, remember that to mount filesystems, you might need the appropriate permissions.
Here’s a breakdown of your commands and what they do:
mkdir ext4_mount
This command creates a directory named `ext4_mount` in your current working directory. This directory will act as a mount point for the ext4 filesystem.
sudo ./ext4fuse /dev/disk2s1 ~/ext4_mount -o allow_other
This command tries to mount the ext4 filesystem found at `/dev/disk2s1` to the `ext4_mount` directory you created. The `-o allow_other` option allows other users to access the filesystem.
Note:
- Ensure `/dev/disk2s1` is correct for your system. You can use the `diskutil list` command to check all available drives and partitions.
- The `sudo` command is used to grant administrative permissions and will ask for your password.
- Ensure that your user has the necessary permissions to access the mount point. The `-o allow_other` flag should allow this, but ensuring the user has the right permissions on the mount point itself is also prudent.
- Keep in mind that `ext4fuse` is read-only, meaning you will be able to read files but not write to the ext4 filesystem.
Always remember to unmount the filesystem once you’re done using it to prevent any data corruption:
sudo umount ext4_mount
Or, if you mounted it using `FUSE`, you might need to use:
sudo diskutil umount ext4_mount
Using ext4 filesystems on macOS via `ext4fuse` allows for cross-platform data access, which can be quite handy for those using macOS and Linux environments simultaneously. Always remember to interact with filesystems and disks with caution to prevent any data loss.
Wrapping Up
Once you've gone through these steps, your macOS should be equipped to read ext4 filesystems via ext4fuse. The ability to access ext4 filesystems can be quite invaluable for cross-platform work or in scenarios where you have Linux data that you want to access on your macOS system. Ensure to check the mounted volume, and you should be able to access your ext4 data transparently on Mac OS Ventura.
For those consistently working with Linux filesystems, consider exploring additional GUI-based tools for a smoother workflow when interacting with ext4 volumes on macOS.
Source: