DEV Community

zankyr
zankyr

Posted on

Make NTFS writable again (on OSX)

Long story short: NTFS is a proprietary filesystem, owned by Microsoft. And thanks to this, all the NTFS formatted hard drives are read-only on a OSX OS.

Following you can find instructions on how to make NTFS writable again, depending on your operating system.

Mojave (10.14.6)

Requirements

Homebrew should be installed.

Update Xcode via Terminal:

$ xcode-select --install
Enter fullscreen mode Exit fullscreen mode

Disable the System Integrity Protection (SIP).

Reboot your Mac, and when the boot screen appears (the one with the Apple logo), press CMD+R, and go into recovery mode.
Once here, open the terminal from the menu' bar and execute the following command.

$ csrutil disable
Enter fullscreen mode Exit fullscreen mode

If the operation is successful, reboot the machine.

osxfuse

Install osxfuse via Homebrew

$ brew install --cask osxfuse
Enter fullscreen mode Exit fullscreen mode

Reboot.

ntfs-3g

The original Homebrew formulae has been disabled since it was not open-source software (you can find the entire motivation in the links at the end of the page).

You can use a fork made by an user:

brew install darelover/ntfs-3g/ntfs-3g
Enter fullscreen mode Exit fullscreen mode

Guess what? Reboot again.

Mount point

First, backup the original mount file:

$ sudo mv /sbin/mount_ntfs /sbin/mount_ntfs.orig
Enter fullscreen mode Exit fullscreen mode

Now, create the new mount file:

sudo ln -s /usr/local/sbin/mount_ntfs /sbin/mount_ntfs
Enter fullscreen mode Exit fullscreen mode

Note: /usr/local/sbin/mount_ntfs should be a symbolic link to the folder created by ntfs-3g. Usually its path should be /usr/local/Cellar/ntfs-3g/<version_number>/sbin

Check

Attach your hard drive. If you're lucky, everything should be working fine.

But you can notice that in the Finder the files are not visible, you can see only folders (via Terminal you should see the entire filesystem correctly).

If you are unlucky, follow this step.
Using the Terminal, go in the ntfs-3g folder, make a backup of the mount_ntfs file and create a new one:

$ cd /usr/local/Cellar/ntfs-3g/<version_number>/sbin
$ sudo mv mount_ntfs mount_ntfs.orig
$ sudo nano mount_ntfs
Enter fullscreen mode Exit fullscreen mode

Copy the following script in the new file you've just created:

#!/bin/bash
VOLUME_NAME="${@:$#}"
VOLUME_NAME=${VOLUME_NAME#/Volumes/}
USER_ID=501
GROUP_ID=20
TIMEOUT=20
if [ `/usr/bin/stat -f "%u" /dev/console` -eq 0 ]; then
        USERNAME=`/usr/bin/defaults read /Library/Preferences/com.apple.loginwindow | /usr/bin/grep autoLoginUser | /usr/bin/awk '{ print $3 }' | /usr/bin/sed 's/;//'`
        if [ "$USERNAME" = "" ]; then
                until [ `stat -f "%u" /dev/console` -ne 0 ] || [ $TIMEOUT -eq 0 ]; do
                        sleep 1
                        let TIMEOUT--
                done
                if [ $TIMEOUT -ne 0 ]; then
                        USER_ID=`/usr/bin/stat -f "%u" /dev/console`
                        GROUP_ID=`/usr/bin/stat -f "%g" /dev/console`
                fi
        else
                USER_ID=`/usr/bin/id -u $USERNAME`
                GROUP_ID=`/usr/bin/id -g $USERNAME`
        fi
else
        USER_ID=`/usr/bin/stat -f "%u" /dev/console`
        GROUP_ID=`/usr/bin/stat -f "%g" /dev/console`
fi

/usr/local/opt/ntfs-3g/bin/ntfs-3g \
         -o volname="${VOLUME_NAME}" \
         -o local \
         -o negative_vncache \
         -o auto_xattr \
         -o auto_cache \
         -o noatime \
         -o windows_names \
         -o user_xattr \
         -o inherit \
         -o uid=$USER_ID \
         -o gid=$GROUP_ID \
         -o allow_other \
         "$@" &> /var/log/mount-ntfs-3g.log

exit $?;
Enter fullscreen mode Exit fullscreen mode

Save the file, save the world.

Change the file's permissions:

$ sudo chmod 555 mount_ntfs
Enter fullscreen mode Exit fullscreen mode

Remove and then reconnect your disk, et-voila'!.

Yosemite (10.10) and El Capitain (10.11)

Disable the System Integrity Protection (SIP).

ONLY FOR EL CAPITAIN
Reboot your Mac, and when the boot screen appears (the one with the Apple logo), press CMD+R, and go into recovery mode.
Once here, open the terminal from the menu' bar and execute the following command.

$ csrutil disable
Enter fullscreen mode Exit fullscreen mode

If the operation is successful, reboot the machine.

osxfuse

Download osxfuse and install it. Flag all the provided options when requested.
Once the installation is finished, reboot the machine.

ntfs-3g

Download and install ntfs-3g. Unfortunately this application is no longer maintained, but this version is still enough for our purposes.
When asked, check the option nocaching.

On El Capitain an error message could be displayed at the end of the installation process. Just ignore it.

Reboot the system.

fuse-wait

Download and install fuse-wait.

Plug, read, write

Attach your hard drive and check that the disk is writable.

Re-enable the SIP

ONLY FOR EL CAPITAIN
Repeat the step 1, but now execute this command:

$ csrutil enable
Enter fullscreen mode Exit fullscreen mode

If the operation is successful, reboot the machine.

Useful links

Homebrew: https://brew.sh/
ntfs-3g original formulae: https://formulae.brew.sh/formula/ntfs-3g#default
Why ntfs-3g formulae has been disabled: https://github.com/Homebrew/homebrew-core/pull/64491

Thanks to

https://wpbeaches.com/how-to-write-to-windows-ntfs-usb-disk-drives-on-macos-macos-mojave-and-sierra/

https://gist.github.com/takeit/9fa83840f3b2065e204dc9d52cef3693

https://github.com/darelover/homebrew-ntfs-3g

https://github.com/osxfuse/osxfuse/issues/574

http://www.macbreaker.com/2014/06/how-to-enable-writing-to-ntfs-hard.html

Discussion (0)