OS X Quick Tip: Always mount USB NTFS flash drives with write access

osx_logoI have a few USB flash drives that are formatted with an NTFS file system which I use in my office when working on my Windows machine there. I work off of these flash drives to be able to easily access my development work while on the go by just ejecting the drive and taking it with me, then inserting them into my Windows machine at home and being exactly where I left off in the office. I recently purchased a beefy new Macbook Pro and want to be able to work from those same flash drives on it. Problem is that by default OS X mounts NTFS drives in read only mode.

I searched google for solutions, but most partially worked or were outdated. The easiest one and also the one that worked for me was this:

  1. Install Homebrew. It’s quite easy following the instructions on their site.
  2. Using Homebrew install ntfs-3g by opening a Terminal window and typing brew install ntfs-3g
  3. The previos command should install ntfs-3g and all of its dependencies which include fuse4x-kext (the kernel extension; requires reboot after install), and fuse4x. Note in the brew command output for fuse4x-kext it tells you a few commands to install the kernel extension which should be something like the following (note the version numbers may be different):
    sudo /bin/cp -rfX /usr/local/Cellar/fuse4x-kext/0.9.2/Library/Extensions/fuse4x.kext /Library/Extensions
    sudo chmod +s /Library/Extensions/fuse4x.kext/Support/load_fuse4x
  4. Finally, if you want to replace the default Mac OS X auto mounter with the one that ntfs-3g uses issue the following commands which will back up the current mount command and then link to the ntfs-3g mount command. Doing this will make it so whenever you plug an NTFS formatted USB drive into your Mac it should mount it using ntfs-3g and therefore be writable. Here are those commands (note again that version numbers in directory paths may be different than yours so you may need to cd to the /usr/local/Cellar/ntfs-3g directory to get the proper version number directory for the last command):
    sudo mv /sbin/mount_ntfs /sbin/mount_ntfs.orig
    sudo ln -s /usr/local/Cellar/ntfs-3g/2012.1.15/sbin/mount_ntfs /sbin/mount_ntfs
 

Start Minecraft 1.6.2 in offline mode on osx

minecraft_iconWith the Minecraft 1.6.x upgrade the launcher no longer has an option to play offline. However this can be accomplished with a startup script. Follow these steps to get a working startup script:

  1. Start the 1.6.x Minecraft launcher, as you normally do, and login to the game. Logging in is necessary to make sure all of the unlocked game files get downloaded to your system.
  2. While the game is running put it into windowed mode (f11) and then go to finder and open your home directory. Navigate to “/Users/<your_home_dir>/Library/Application Support/minecraft” (your Library folder may be hidden, so either force it to show via finder preferences or just type the path in by Choosing the “Go > Go to Folder…” option in the Finder menu). Within here you should have a “versions” folder. Navigate to that folder and now you will see subfolders for each version of the game you have played via the new launcher. In my case I have a 1.6.2 folder. Open the version folder for whichever version you currently have running in the background and in there you’ll see a 1.6.2-natives-<random numbers> folder. This folder gets created with a different timestamp (the random numbers) every time you run minecraft via the new launcher. Copy this folder up one directory so it is sitting in the versions folder, and therefore will not be deleted when you quit the instance of Minecraft that is currently running.
  3. Now go to the Minecraft launcher and click on the “Development Console” tab. Here you’ll see a bunch of output. Starting from the beginning (top) find the line that starts with “Running”. Copy everything after “Running ” up until the line that states “—- YOU CAN CLOSE THIS LAUNCHER IF THE GAME STARTED OK —-“. It should look something like this with <home> being your own home directory name:
  4. Now we’ll create the file to paste this block of text into. Open a terminal window (Launchpad > Other > Terminal) and go to the minecraft directory we’ve been working in and create a startup script file:
    cd /Users/<home>/Library/Application Support/minecraft/
    sudo nano startup1.6.2.sh
    Paste the clipboard contents into the nano window.
  5. Here it gets a bit tricky. You need to surround parts of the command line you just pasted with quotes so the spaces don’t get interpreted incorrectly. Starting after -Xdock:icon= insert a double quote (“). and continue to the end of the path for that parameter which should be minecraft.icns and insert a double quote after it. Next insert a double quote after -Djava.library.path= and follow that to the end of the parameter path which should be the name of the natives folder we dealt with earlier and place a double quote there. While we’re here we also need to modify the path to that natives folder since we copied it up one level, so delete the version number folder in that path (versions/1.6.2/1.6.2-natives-1373766486290585000 the red bolded folder here in my case). Next we need to double quote the classpath (cp) parameter. For the path following the -cp insert a quote at the beginning of the path and go all the way to the last jar (1.6.2.jar for me) in that path parameter to add a ” to the end of it. Next surround the path specified for the –gameDir parameter and finally do the same for the –assetsDir parameter. In my case the final result is:
  6. Save the file by pressing ctrl-o <enter> and then exit with ctrl-x.
  7. Now you need to change permissions on your startup script to make it executable. Within terminal type sudo chmod +x startup1.6.2.sh
  8. Now make sure your currently running Minecraft game is closed and we’ll try our startup script by typing ./startup1.6.2.sh in the terminal window. You should see output similar to what you normally see in the development console of the launcher and the game should start up.

Some things to look for if it doesn’t work for you the first time. First make sure your path parameters are properly quoted. It may be helpful to open the startup script in a GUI text editor like TextWrangler so you can see the quoted parameters color coded. Second, make sure the path to the natives folder you copied is correct because if you happen to copy the folder at a different time then when you copy the running command they’ll be named differently since the natives folder gets created with a timestamped name every time the launcher runs the game.

Note that by using this startup script to play in offline mode it is possible, within the same LAN, to have one person launch a game then within the game options choose “Open to LAN” and have a second (or more) person on another computer launch via the startup script to join the multiplayer game hosted on the same LAN. Within the startup script there is a –username attribute which you can set to anything you want your in-game name to be when you are playing on a LAN based game.

In my next post I’ll show you how to add the startup script we created here as an app within Launchpad, the Applications folder, or on your dock. Also, if there is enough interest, I’ll show you how to make this work if you are on Java 7. If you have any problems, see any mistakes I’ve made, or have questions, give me some comments and I’ll respond as soon as I can. Thanks and happy mining…err crafting…err both.

 
Return top