| 1 | These instructions have been liberally copied [http://fernandofig.wordpress.com/2011/08/08/ntfs-write-support-on-osx-lion-with-ntfs-3g-f/ from this excellent blog post]. |
| 2 | |
| 3 | === Step 1. Install the ntfs-3g port. === |
| 4 | {{{ |
| 5 | sudo port install ntfs-3g |
| 6 | }}} |
| 7 | |
| 8 | === Step 2. Find out your userid and groupid. === |
| 9 | User ID: |
| 10 | {{{ |
| 11 | id -u |
| 12 | }}} |
| 13 | Group ID: |
| 14 | {{{ |
| 15 | id -g |
| 16 | }}} |
| 17 | |
| 18 | === Step 3. Use a modified mount_ntfs executable and save the OS X original to {{{/sbin/mount_ntfs.orig}}} === |
| 19 | {{{ |
| 20 | sudo mv /sbin/mount_ntfs /sbin/mount_ntfs.orig |
| 21 | sudo touch /sbin/mount_ntfs |
| 22 | sudo chmod 0755 /sbin/mount_ntfs |
| 23 | sudo chown 0:0 /sbin/mount_ntfs |
| 24 | sudo nano /sbin/mount_ntfs |
| 25 | }}} |
| 26 | |
| 27 | Then paste in the following code and save it by typing Control-X and pressing "Y". NOTE: |
| 28 | - You can optionally substitute in your User ID and Group ID (from Step 2 above) in place of 501 and 20 in lines 4 and 5 below. |
| 29 | - This script also assumes the standard Macports install location of {{{/opt/local/}}} so you will need to modify it if yours is different. |
| 30 | |
| 31 | {{{ |
| 32 | #!/bin/bash |
| 33 | VOLUME_NAME="${@:$#}" |
| 34 | VOLUME_NAME=${VOLUME_NAME#/Volumes/} |
| 35 | USER_ID=501 |
| 36 | GROUP_ID=20 |
| 37 | TIMEOUT=20 |
| 38 | if [ `/usr/bin/stat -f "%u" /dev/console` -eq 0 ]; then |
| 39 | USERNAME=`/usr/bin/defaults read /library/preferences/com.apple.loginwindow | /usr/bin/grep autoLoginUser | /usr/bin/awk '{ print $3 }' | /usr/bin/sed 's/;//'` |
| 40 | if [ "$USERNAME" = "" ]; then |
| 41 | until [ `stat -f "%u" /dev/console` -ne 0 ] || [ $TIMEOUT -eq 0 ]; do |
| 42 | sleep 1 |
| 43 | let TIMEOUT-- |
| 44 | done |
| 45 | if [ $TIMEOUT -ne 0 ]; then |
| 46 | USER_ID=`/usr/bin/stat -f "%u" /dev/console` |
| 47 | GROUP_ID=`/usr/bin/stat -f "%g" /dev/console` |
| 48 | fi |
| 49 | else |
| 50 | USER_ID=`/usr/bin/id -u $USERNAME` |
| 51 | GROUP_ID=`/usr/bin/id -g $USERNAME` |
| 52 | fi |
| 53 | else |
| 54 | USER_ID=`/usr/bin/stat -f "%u" /dev/console` |
| 55 | GROUP_ID=`/usr/bin/stat -f "%g" /dev/console` |
| 56 | fi |
| 57 | |
| 58 | /opt/local/bin/ntfs-3g \ |
| 59 | -o volname="${VOLUME_NAME}" \ |
| 60 | -o local \ |
| 61 | -o negative_vncache \ |
| 62 | -o auto_xattr \ |
| 63 | -o auto_cache \ |
| 64 | -o noatime \ |
| 65 | -o windows_names \ |
| 66 | -o user_xattr \ |
| 67 | -o inherit \ |
| 68 | -o uid=$USER_ID \ |
| 69 | -o gid=$GROUP_ID \ |
| 70 | -o allow_other \ |
| 71 | "$@" &> /var/log/ntfsmnt.log |
| 72 | |
| 73 | exit $?; |
| 74 | }}} |