Last active
October 6, 2022 16:02
-
-
Save naingyeminn/6951b92faae540260026cb865f84231c to your computer and use it in GitHub Desktop.
NTFS-3G Mount Script for MacOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#---- ---- ---- ---- | |
# Copyright (C) Naing Ye Minn <[email protected]> | |
# This file is free software; as a special exception the author gives | |
# unlimited permission to copy and/or distribute it, with or without | |
# modifications, as long as this notice is preserved. | |
#---- ---- ---- ---- | |
# Install osxfuse and ntfs-3g via brew | |
# $ brew cask install osxfuse | |
# $ brew install ntfs-3g | |
# Run following in case of any issue | |
# $ brew link --overwrite ntfs-3g | |
# Install ntfsmount script | |
# $ curl -Lo /usr/local/bin/ntfsmount http://tiny.cc/ntfsmount | |
# $ chmod +x /usr/local/bin/ntfsmount | |
# Ref: https://github.com/osxfuse/osxfuse/wiki/NTFS-3G | |
#---- ---- ---- ---- | |
for volume in "/Volumes"/* | |
do | |
volumeInfo=$(diskutil info "$volume") | |
volumeName=$(grep "Volume Name" <<< "$volumeInfo" | cut -d ':' -f2 | sed -e 's/^[[:space:]]*//') | |
volumeType=$(grep "Type (Bundle):" <<< "$volumeInfo" | cut -d ':' -f2 | tr -d ' ') | |
deviceNode=$(grep "Device Node:" <<< "$volumeInfo" | cut -d ':' -f2 | tr -d ' ') | |
if [[ $volumeType == 'ntfs' ]]; then | |
sudo umount "/Volumes/$volumeName" | |
sudo /usr/local/bin/ntfs-3g "$deviceNode" "/Volumes/$volumeName" -o local -o allow_other -o auto_xattr -o volname="$volumeName" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
First 3 lines could change to:
cd /Volumes/
#for volume in "/Volumes"/*
for volume in *
......