MacFuse and Ruby fusefs extension

Posted on March 09, 2007

Lately I've been playing with MacFuse project and all I could say is that this is a fantastic effort of bringing the well-known user-space(fuse) file system to the OSX land. The latest versions of fuse work well with FreeBSD and MacFuse extends this functionality to OSX platform.

My goal was to make Ruby's fusefs extension play along with it. The major stumbling point was that MacFuse requires using the new fuse API, so I had to make several modifications to fusefs in order to make it possible at least to compile it.

OK. If you are a braveheart type and not afraid that it might damage your computer, these are the steps you need to do in order to install this extension:

  1. Download the latest version of MacFuse and use the installer that it comes with.

  2. Check out my version of fusefs from http://svn.datanoise.com/fusefs-osx and use the standard procedure of installing Ruby extensions:

    $ svn co http://svn.datanoise.com/fusefs-osx
    $ cd fusefs-osx
    $ make
    $ sudo make install
    

That's about it. Now you can start playing with examples located in <fusefs-osx>/sample directory. When you are at it, I'd like you to take a look at one of my personal toys - the remote DRb-based file system. It is located in <fusefs-osx>/sample/drb directory and that's how you use it:

  1. On the remote side (a Windows box will do just fine) start the drb server:

    $ ruby ./sample/drb/drbfs_server.rb ~/shared
    druby://myhost:7777
    

    The script takes the name of a directory you want to share. When the script is started, it'll print the URL you have to use when you mount your DRb filesystem on the client side.

  2. On the client side, mount DRb file system:

    $ ruby ./sample/drb/drbfs.rb mount/ druby://myhost:7777
    $ ls mount
    

    The client script takes the name of a directory you want to mount to and the URL of the server from the step one.

Enjoy and don't forget to read <fusefs-osx>/OSX.txt for the important API changes.

Comments
  1. Kevin MarshMarch 09, 2007 @ 04:57 PM

    Thanks a ton for picking this up and running with it!

  2. Greg MillamMarch 13, 2007 @ 12:06 PM

    Howdy - I've had the CVS version of FuseFS working with MacFUSE for about a month or 2 now, but it has issues on unmounting (I can't really debug easily since I don't have access to a MAC myself). Do you mind if I take some code from your fusefs-osx?

    Thanks!

    • Greg
  3. KentMarch 14, 2007 @ 01:49 AM

    Greg,

    Be my guest. I had to change the umounting procedure and manually run umount dir in order to make it work. Another problem that I ran into was that fusefs restricts the list of parameters you can pass to fuse, which is very essential in MacFuse case. For example, most of the time you want to enable nolocalcaches.