Phase 1: Get the stuff

There are a couple of stuff that you need to download first. Open the Terminal application and create a new folder somewhere on your disk like ~/Desktop/fuse/ and then 'cd' to it.
  1. MacFuse (http://code.google.com/p/macfuse)
  2. Download the Python FUSE bindings from FUSE's CVS repository. Checkout the python module using:
    cvs -d:pserver:anonymous@fuse.cvs.sourceforge.net:/cvsroot/fuse co -P python
  3. Download a copy of libgmail. Recent releases currently work however if you experience problems you may wish to grab the CVS version of libgmail by following the instructions here.
  4. Download gmailfs-0.7.2.tar.gz.

Phase 2: Install

Start by installing MacFuse. Mount the disk image, open the installation package and simply walk through the assistant. Restart when you're done.

Then, open the Terminal and do the following
$ cd ~/Desktop/fuse

Let's start with libgmail
$ tar -zxvf libgmail-0.1.5.1.tar.gz
$ cd libgmail-0.1.5.1
$ python setup.py build
$ sudo python setup.py install
Password : <<enter your password here >>

Now let's move on to FUSE python bindings. This is the complex part. Before you can compile the bindings, you  need to create a file to inform pkg-config where is your fuse installation.
Copy/Paste what's below and save it to ~/Desktop/fuse/fuse.pc
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: fuse
Description: Filesystem in Userspace
Version: 2.6.1
Libs: -L${libdir} -lfuse -pthread
Cflags: -I${includedir}/fuse -D__FreeBSD__=10 -D_FILE_OFFSET_BITS=64

Now, copy the file somewhere inside your PKG_CONFIG_PATH
$ sudo cp ~/Desktop/fuse/fuse.pc /usr/local/lib/pkg-config/

Of course if pkg-config is not installed on your system, you need it too :
Get it there : http://pkgconfig.freedesktop.org/wiki/.

To compile and install pkg-config as a set of Universal binaries, do the following:

$ tar -xzvf pkg-config-<version>.gz
$ cd pkg-config-<version>/
$ CFLAGS="-O -g -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk" \
LDFLAGS="-arch i386 -arch ppc" \
./configure --prefix=/usr/local --disable-dependency-tracking
$ make
$ sudo make install

This installs pkg-config under the /usr/local/ hierarchy.


You are  now ready to build the python bindings, so go there
$ cd ~/Desktop/fuse/python
$ python setup.py build

Should this fail or complain about something called osreldate.h, just go to the header that includes osreldate.h
and comment out the inclusion for now.

$ sudo python setup.py install
Password : <<enter your password here >>

The last thing you install is gmailfs itself. Go to your download directory again and prepare the stuff
$ cd ~/Desktop/fuse
$ tar -zxvf gmailfs-0.7.2.tar.gz
$ cd gmailfs-0.7.2

$ sudo cp mount.gmailfs /sbin/mount_gmailfs
$ sudo cp gmailfs.py /usr/local/bin/

Now gmailfs is installed on your system. We're almost there.

Phase 3: Configuration

In ~/Desktop/fuse/gmailfs-0.7.2 there is a file called gmailfs.conf. Open it and insert your personal info (like your username and password to Google Gmail service). Then copy this file to your /private/etc folder
$ sudo cp gmailfs.conf /private/etc

Create a test folder that will become your mountpoint
$ mkdir ~/gmailfs

Inform FUSE_PYTHON_COMPAT
$ export FUSE_PYTHON_COMPAT=ALL
Alternatively, you can set  FUSE_PYTHON_COMPAT=0.1 is the mount command fails

Try to mount your GMail Disk :
$ mount -ovolname=bla -t gmailfs /usr/local/bin/gmailfs.py ~/gmailfs
Looks like -ovolname is ignore ...

$ df -h
Filesystem                                Size   Used Available Capacity  Mounted on
/dev/disk0s5                             90Gi  32Gi  58Gi    36%    /
devfs                                   114Ki 114Ki     0B   100%    /dev
fdesc                                   1.0Ki 1.0Ki     0B   100%    /dev
/dev/disk0s3                             59Gi  51Gi 8.5Gi    86%    /Volumes/HD 150Go
automount -fstab [110]                      0B     0B     0B   100%    /automount/Servers
automount -static [110]                     0B     0B     0B   100%    /automount/static
python@0                                2.7Gi     0B 2.7Gi     0%    /Users/jms/gmailfs

When this is done, you can copy stuff there and it will be saved on gmail space automatically
$ cp intro.mov ~/gmailfs

Well that about it. I hope you have something new to play with too.

I could not get it to work properly with the Finder (Drag and drop doesn't work all the time, got some .DS_Store annoyance too) but I probably just did not look hard enough. Anyway, if you have a solution, feel free to post it below, for now, <ad>i'll stick to gDisk</ad>.