Skip to content

Instantly share code, notes, and snippets.

@tt6746690
Created November 19, 2016 05:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tt6746690/e2107586f47172f5cac48a8063555230 to your computer and use it in GitHub Desktop.
Save tt6746690/e2107586f47172f5cac48a8063555230 to your computer and use it in GitHub Desktop.
mount ntfs
#!/bin/bash
# enable writing to NTFS drives
function mount {
diskutil list
echo “please enter the ntfs disk to be mounted:”
read inp
#### http://mywiki.wooledge.org/BashFAQ/031#np2
if [[ $inp =~ ^.*(disk0).*$ || $inp =~ ^.*(disk1).*$ ]]; then
echo dangerous input!
mount
else
diskutil unmount /dev/$inp
mkdir /Volumes/NTFS
ntfs-3g /dev/$inp /Volumes/NTFS
open /Volumes/NTFS
fi
}
while true; do
read -p “mount_to_enable_WRITE?” yn
case $yn in
[Yy]* ) mount; break;;
[Nn]* ) exit;;
* ) echo “Please answer yes or no.”;;
esac
done
# === ALTERATIONS ===
# OS X does not support writing to NTFS format HD, therefore install FUSE and
# ntfs-3g, HOWEVER there is a problem.
# originally for /sbin/mount_ntfs
# mount_ntfs -> /System/Library/Filesystems/ntfs.fs/Contents/Resources/mount_ntfs
# symlinked replaced with
# mount_ntfs -> /usr/local/Cellar/ntfs-3g/2016.2.22/sbin/mount_ntfs
# but can’t be done due to OS X security. Therefore use the following
#sudo mkdir /Volumes/NTFS
#diskutil list
#sudo ntfs-3g /dev/disk2s1 /Volumes/NTFS
#open /Volumes/NTFS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment