Skip to content

Instantly share code, notes, and snippets.

@dubiao
Created April 15, 2026 09:33
Show Gist options
  • Select an option

  • Save dubiao/3fbf68ef2a2bff0466321395f8ddc6e7 to your computer and use it in GitHub Desktop.

Select an option

Save dubiao/3fbf68ef2a2bff0466321395f8ddc6e7 to your computer and use it in GitHub Desktop.
Mount NTFS drives as writable on macOS
#!/bin/bash
if [ "$1" = "-d" ] ; then
dev=$2
volume=$3
diskutil info $dev|grep NTFS>/dev/null
if [ $? -ne 0 ] ; then
echo "The recently mounted disk: $dev is not an NTFS disk! Press Return to exit"
read
else
diskutil umount $volume>/dev/null
echo "Please enter the password for user ${USER}"
sudo mkdir $volume
sudo mount -t ntfs -o rw,auto,nobrowse $dev $volume>/dev/null 2>&1
if [ $? -ne 0 ] ; then
echo "The disk needs to be checked and repaired on Windows before it can be mounted as writable!"
echo "Press Return to exit"
sudo umount $volume>/dev/null 2>&1
sudo rm -r $volume
read
exit
fi
open $volume
echo "Press Return to unmount $volume"
read
until sudo umount $volume
do
echo "Please close any programs using $volume, then press Return to unmount $volume"
read
done
fi
else
N=1
`echo df`| while read myline
do
N=`expr $N + 1`
if [ $N -gt 2 ] ; then
dev=$myline
volume=`echo ${dev##*% }|sed 's/\ /\\\ /g'`
dev=${dev%% *}
echo "~/ntfs.sh -d ${dev} ${volume}"
fi
done
echo "Copy the command line for the disk you want to mount. Remember to come back here to unmount before ejecting."
echo "~/ntfs.sh is the path to the script. -d is the execution flag."
fi
exit
@dubiao
Copy link
Copy Markdown
Author

dubiao commented Apr 15, 2026

(Assuming) place it in the ~ directory. Run:

chmod +x ~/ntfs.sh

Then execute:

~/ntfs.sh

It will list all disks. Copy the command line for the disk you want to mount and run it.

Do not close the terminal after mounting. Keep it open until you are done, then close it to unmount properly — otherwise you may not be able to use the disk afterwards.

@dubiao
Copy link
Copy Markdown
Author

dubiao commented Apr 15, 2026

Failure to mount an NTFS disk is usually caused by the disk being in a "hibernation" or "dirty" state due to not being safely removed on Windows.

Typical fix:
Connect it back to a Windows PC and safely eject it, or repair it using chkdsk:

chkdsk /f X:

(Replace X with the actual drive letter of your hard disk.)


Even this may not always work. Just make do with it for now.

@dubiao
Copy link
Copy Markdown
Author

dubiao commented Apr 15, 2026

You can also install Mounty.
Run these three commands:

brew install --cask macfuse
brew install gromgit/fuse/ntfs-3g-mac
brew install --cask mounty

Mounty version 2 now acts as a graphical user interface for the third-party driver NTFS-3G. This brings NTFS write support back to macOS, but the installation is now a bit more complex. You need two additional pieces of software to use with Mounty 2: macFUSE and NTFS-3G for Mac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment