Skip to content

Instantly share code, notes, and snippets.

@phtmgt
Created August 25, 2025 18:37
Show Gist options
  • Save phtmgt/02130d28af7e2c0c2bd2c3ab19e3973e to your computer and use it in GitHub Desktop.
Save phtmgt/02130d28af7e2c0c2bd2c3ab19e3973e to your computer and use it in GitHub Desktop.
NTFS read/write remount script for macOs 26 Tahoe (install macfuse and ntfs-3g-mac first)
#!/bin/bash
NTFS3G_BIN="/opt/homebrew/bin/ntfs-3g"
if [ ! -x "$NTFS3G_BIN" ]; then
echo "Error: ntfs-3g not found at $NTFS3G_BIN"
exit 1
fi
echo "Scanning for NTFS partitions..."
# Get all partitions (diskXsY)
partitions=$(diskutil list | awk '/disk[0-9]+s[0-9]+/ {print $NF}')
if [ -z "$partitions" ]; then
echo "No partitions found."
exit 0
fi
for part in $partitions; do
info=$(diskutil info "$part")
fs_type=$(echo "$info" | awk -F: '/File System Personality|Partition Type/ {gsub(/^[ \t]+|[ \t]+$/,"",$2); print $2; exit}')
media_type=$(echo "$info" | awk -F: '/Device Location/ {gsub(/^[ \t]+|[ \t]+$/,"",$2); print $2}')
vol_name=$(echo "$info" | awk -F: '/Volume Name/ {gsub(/^[ \t]+|[ \t]+$/,"",$2); print $2}')
mount_point=$(echo "$info" | awk -F: '/Mount Point/ {gsub(/^[ \t]+|[ \t]+$/,"",$2); print $2}')
echo "Partition: $part, fs_type='$fs_type', media_type='$media_type', vol_name='$vol_name', mount_point='$mount_point'"
if [[ "$fs_type" == *NTFS* ]] && [[ "$media_type" == "External" ]]; then
# Unmount the current macOS read-only mount
diskutil unmount "$mount_point"
# Ensure mount point exists
sudo mkdir -p "$mount_point"
# Mount using ntfs-3g
sudo "$NTFS3G_BIN" /dev/$part "$mount_point" -olocal -oallow_other
echo "Mounted '$vol_name' with NTFS-3G at $mount_point."
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment