How to Write to NTFS Drives in macOS Catalina and later

Feb 17
How to Write to NTFS Drives in macOS Catalina and later

If you have been figuring out how to write to NTFS drives natively in macOS Catalina and later and have found numerous articles but nothing works, then you are finally at the right destination. I have been facing issues in enabling NTFS write functionality in my Macbook Pro 2017 model after upgrading to macOS Catalina. Earlier i used brew and fuse and everything worked right but not from macOS Catalina onwards, as the file system has been restructured by Apple from macOS Catalina onwards. You may read about that anywhere else but currently here we need to enable Native NTFS write support in your macOS. So let's do it.

Broadly these are the steps that we need to follow:

1. Install Xcode and terminal tools.

2. Install MacPorts.

3. Check if you have upgraded your terminal from bash to zsh.

4. Install Fuse and NTFS-3g.

5. Disable SIP (System Integrity Protection).

6. Force macOS to use NTFS-3g by default.

7. Enable SIP.

That particular order is what i used to achieve permanent ntfs write support in my macOS and have since been able to write to NTFS drives natively. There are many blogs out there covering some of the topics above but none of them covers all of them at a single place. Luckily I am your GOD today ;) So let's begin.

Step 1: Install Xcode and terminal tools:

Open up your terminal in macOS and write the code line below to install Xcode and terminal tools (Copy-Paste recommended).

xcode-select --install

An installation window shall pop up where you need to click "Install" and then "Accept" and proceed with the full installation.

Step 2: Install MacPorts:

Please download the MacPorts package (.pkg) from this link and install the same by clicking and pressing the regularized buttons :P

Step 3: Check if you have upgraded your terminal from bash to zsh:

For some reason that Apple finds it reasonable, the default shell terminal from macOS Catalina onwards has been changed from bash to zsh and you, on all earth, are supposed to write a line of code in your terminal, to facilitate that change from bash to zsh. The line of code is present whenever you open the terminal and it's a one time change. For those who are still figuring out the line, please check below:

chsh -s /bin/zsh

Please enter your system password when prompted to make the changes. Please note that this step is necessary for the next step to be completed successfully.

Step 4: Install Fuse and NTFS-3g:

Please download and install FUSE from this link. Please open the terminal after successfull installation and copy paste the following command.

sudo ln -s /usr/local/lib/pkgconfig/fuse.pc /opt/local/lib/pkgconfig/fuse.pc

If for some reason the above command shows message that the file already exists, then simply remove the file using command below and retry the command above. It shall work.

sudo rm /opt/local/lib/pkgconfig/fuse.pc

Please install NTFS-3g by writing the following command in the terminal.

sudo port install ntfs-3g

If your face any issue in installing ntfs-3g with the above command, then you can add /opt/local/bin to the execcutable PATH so that the port command is available to the shell. You can do that by writing the following command in the terminal.

export PATH=$PATH:/opt/local/bin

If ntfs-3g is installed properly then you can proceed further.

Step 5: Disable SIP (System Integrity Protection):

There are many blog links using graphical screenshots to guide you and you may search the same. However for PROs, you can simple follow what I am just typing. Please shut down your macOS and start it again. While starting, keep Command and R buttons pressed until you are logged in to the Recovery mode of macOS. Now go to the menu Utilities and open Terminal. Write the following first command to disable SIP. Write the next command if you are in Big Sur or above.

csrutil disable
csrutil authenticated-root disable

Please reboot your system.

Step 6: Force macOS to use NTFS-3g by default:

Go to the root directory of terminal by typing cd / and then use the following command in terminal to make the root system writeable.

sudo mount -uw /

From MacOS Big Sur onwards, the above command will not work, so you may follow this twitter thread to mount the filesystem and write to it.

Now just for precaution you need to your User ID and Group ID so that you can force macOS to write to NTFS natively. Please execute the following terminal commands one after another to know the same.

id -u
id -g

The above commands should normally return 501 and 20 as output. Please note if you get any different numbers. Those numbers will be needed later. Now copy and paste the following magical force commands one line at a time only.

sudo mv /sbin/mount_ntfs /sbin/mount_ntfs.orig
sudo touch /sbin/mount_ntfs
sudo chmod 0755 /sbin/mount_ntfs
sudo chown 0:0 /sbin/mount_ntfs

The above commands won't work if you are using Big Sur and above so use follow the above twitter thread to check your OS drive (diskutil list) and then use your created mount point in the above code.

sudo mount -o nobrowse -t apfs /dev/disk1s5 ~/mount

For example if you create a folder called mount in your user home directory then the above commands will be:

sudo mv ~/mount/sbin/mount_ntfs ~/mount/sbin/mount_ntfs.orig
sudo touch ~/mount/sbin/mount_ntfs
sudo chmod 0755 ~/mount/sbin/mount_ntfs
sudo chown 0:0 ~/mount/sbin/mount_ntfs

Now type the following command to edit mount_ntfs file.

sudo nano /sbin/mount_ntfs

And if you are using Big Sur and above and following the above said then the given code will be written as:

sudo nano ~/mount/sbin/mount_ntfs

Now copy - paste the following text into the terminal window and then save the file by pressing "Ctrl-X" and then "Y". Alternatively you may press "Ctrl-O" and "Ctrl-X" also and it would work the same.

#!/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
/opt/local/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/ntfsmnt.log
exit $?;

Please note that you may replace the USER_ID and GROUP_ID with the numbers that you had got earlier if they are different, i.e. other than 501 and 20.

If you are following the Big Sur parallel line of tutorial here then you have to write the below code additionally:

sudo bless --folder ~/mount/System/Library/CoreServices --bootefi --create-snapshot

And you are done. Reboot and use. Congratulations you can now write to any NTFS drives.

Step 7: Enable SIP:

Last but not the least, please re-enable SIP (System Integrity Protection) as it is a security issue. You may login to the recovery mode again by restarting macOS and pressing Command and R buttons. Please type the commands below to re-enable SIP.

csrutil enable

There you go. Congratulations again for your success. Please share this article and comment down below if you found it useful. Thank you very much for patient reading and working.

Next Post Previous Post