Wednesday, June 29, 2011

Fix missing source for Java Mac OS X 10.6 Update 5

Once again, Apple does something stupid to us poor idiot Java developers. This will make clicking through to the JDK source work in Eclipse again after updating to the latest Java for Mac OS X.
  1. Go to and download Java for Mac OS X 10.6 Update 5 Developer Package
  2. Install it.
  3. Open a window
  4. cd /System/Library/Frameworks/JavaVM.framework/Home
  5. sudo ln -s /Library/Java/JavaVirtualMachines/1.6.0_26-b03-384.jdk/Contents/Home/src.jar .
  6. sudo ln -s /Library/Java/JavaVirtualMachines/1.6.0_26-b03-384.jdk/Contents/Home/docs.jar .

Thursday, June 2, 2011

Mount an Ubuntu virtual machine via NFS on a Mac

I do a lot of local development in various Ubuntu virtual machines running in vmware fusion. I do some work in them, mess them up and then delete them when I'm done. It tends to be a pain to xfer data between the VM and my local host machine, so I found a simple way to do it with NFS exports from the VM, mounted on my Mac.

For simplicity, first setup your VM with bridged networking. Then, execute this as root on your vm:

aptitude install nfs-common nfs-kernel-server portmap
echo "/var *(rw,no_subtree_check,all_squash,anonuid=0,anongid=0)" >> /etc/exports
echo "/etc *(rw,no_subtree_check,all_squash,anonuid=0,anongid=0)" >> /etc/exports
invoke-rc.d nfs-kernel-server restart || true

Obviously edit the echo statements above to export different directories.

Open up the DiskUtility application and select File->NFS Mounts...

Enter the IP address of your VM / mountpoint (nfs:// and the mount location on your local Mac. Given the example above that mounts /etc and /var, you'd probably want something like /Volumes/var and /Volumes/etc

You also need to pass -P for the Advanced Mount parameters.

That's it! Now you have root write access on your VM from your Mac.