Skip to content

Instantly share code, notes, and snippets.

@ecamellini
Created June 22, 2020 17:54
Show Gist options
  • Save ecamellini/0f4fa0f0a51d1f222ce6477b2a151092 to your computer and use it in GitHub Desktop.
Save ecamellini/0f4fa0f0a51d1f222ce6477b2a151092 to your computer and use it in GitHub Desktop.
Script to mount an NTFS file on Mac OS, enabling read/write.
#! /bin/bash
########## PREREQUISITES ##########
# This script uses NTFS-3G to mount an NTFS file on Mac OS.
# See: https://github.com/osxfuse/osxfuse/wiki/NTFS-3G
# See also: https://www.makeuseof.com/tag/solving-the-read-only-external-hard-drive-problem-on-your-mac/
# TL;DR;
# brew install ntfs-3g
# brew cask install osxfuse
# mkdir /Volumes/NTFS
# The first time you launch it, the OS may require you to give some permissions to FUSE
########## USAGE ##########
# The file system identifier can be found by running the following:
# diskutil list
# If you see your external drive as /dev/disk3, make sure to check which partition is the NTFS to mount
# If it's partition 1, then the id you want to use is /dev/disk3s1
# You will then be able to read/write the content of the NTFS disk in /Volumes/NTFS;
# You will also see a FUSE volume in the finder
########## UNMOUNTING ##########
# diskutil unmount /Volumes/NTFS
if [ $# -eq 1 ]
then
FILE_SYSTEM=$1
diskutil unmount $FILE_SYSTEM
sudo ntfs-3g $FILE_SYSTEM /Volumes/NTFS -olocal -oallow_other
else
echo "Read script comments before using."
echo "Usage: mount-ntfs ntfs/file/system"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment