Adventures in MacPorts: FuseFS Edition

On Saturday, Richard Crowley published an awesome looking hack called PownceFS that creates a FUSE filesystem mounting your friends’ files from Pownce as a local filesystem. Cool! Now lets try getting it working on the Mac…

# port install fuse-bindings-python
...
--->  Activating fusefs 1.1_3+darwin_9
Error: Target org.macports.activate returned: Image error: /Library/Filesystems/fusefs.fs/Contents/Info.plist already exists and does not belong to a registered port.  Unable to activate port fusefs.
Error: Status 1 encountered during processing.

Well, that sucks. MacPorts doesn’t play nice if you installed macfuse. Apparently there’s a proper way to uninstall, but I missed this, and just did a quick and dirty fix…

# rm -rf /Library/Filesystems/fusefs.fs/
# port install fusefs
--->  Activating fusefs 1.1_3+darwin_9
********************************************************
*  fusefs is already loaded. You may need to restart.  *
*  Alternatively, if feeling adventurous, you can run  *
*  `sudo kextunload -b com.google.filesystems.fusefs`  *
********************************************************
--->  Cleaning fusefs

Now libfuse installs properly. If you get errors, fusefs probably didn’t install properly (see Ticket #11471: fusefs misses common/fuse_param.h).

Now, if you install on 10.5, fuse-bindings-python will install python24 (Leopard ships w/ 2.5 as default), which is sort of retarded, but whatever. You may get some errors w/ fuse-bindings-python, where it gets confused about the install location – just run it again if you just installed python24 and it should work. Next, oauth:

# cd /opt/local/lib/python2.4/site-packages
# svn co http://oauth.googlecode.com/svn/code/python/oauth

Now, check out PownceFS – you’ll need to change the shebang to: #!/opt/local/bin/python2.4.

This is where I’d like to report great success, but well, it looks like the fuse-bindings-python broken:

>>> import fuse
Traceback (most recent call last):
  File "", line 1, in ?
  File "/opt/local/lib/python2.4/site-packages/fuse.py", line 26, in ?
    from fuseparts._fuse import main, FuseGetContext, FuseInvalidate
ImportError: Failure linking new module: /opt/local/lib/python2.4/site-packages/fuseparts/_fusemodule.so: Symbol not found: ___CFConstantStringClassReference
  Referenced from: /opt/local/lib/libfuse.0.dylib
  Expected in: flat namespace

Hey, looks like CoreFoundation isn’t being linked. Turns out someone submitted a patch just yesterday to fix this. You can fix this manually by editing the libfuse Portfile. In my case, it’s in /opt/local/var/macports/sources/rsync.macports.org/release/ports/fuse/libfuse/Portfile – you can add the following line below the patchfiles fuse-2.7.1-macosx.patch line:

configure.ldflags-append    -framework CoreFoundation

Now, reinstall (uninstall the python-bindings and the libfuse packages and reinstall) and import fuse will stop barfing at you. Sweet Jesus we’re almost there… The final step is installing json-py – just unzip this in your site-packages folder.

And… well, it sort of works. It’s mounted:

Python@fuse1     0Bi    0Bi    0Bi   100%    /Users/lhl/powncefs

And while I can’t do any file operations, I can tab complete and see some friends:

lhl@octo powncefs $ ls powncefs/
ls: powncefs/: Operation not permitted
lhl@octo powncefs $ ls 
MarcD              deprimer           mattb              rnair
TheBrad            edwardho           maximolly          ryancarson
adactio            elatable           me3dia             samfelder
agendacide         elbowdonkey        meandmybadself     spullara
akoblin            fauxstor           migurski           sugarlime
allaboutgeorge     fraying            mlaaker            symphonicknot
ask                iamcal             monstro            t
basictheory        jamescronin        mroth              thincvox
beach              jmacias            natekoechley       uvince
benvoluto          jmcnally           neb                waxpancake
botz               joshuakaufman      nickf              whatevernevermind
buzz               kentgoldman        paulh              xeni
carriewestlake     kevnull            peterme            yahooza
caterina           laughingsquid      photojunkie        
chaddickerson      leia               plasticbagUK       
dansays            lhl                rabble             

Well, it’s getting late. Good luck and hope this helps for anyone trying to get PownceFS working on OS X.