So I've been looking for a way to mount my Android phone on my mac file system. Seems to have been an issue for a long time. Found this:

https://github.com/spion/adbfs-rootless

Build adbfs-rootless

git clone https://github.com/spion/adbfs-rootless  
cd adbfs-rootless  

Instructions are for Linux and it has a dependency on fuse that isn't satisfied if I just try to run make:

~/dev/projects/adbfs-rootless $ make
Package fuse was not found in the pkg-config search path.  
Perhaps you should add the directory containing `fuse.pc'  
to the PKG_CONFIG_PATH environment variable  
No package 'fuse' found  
c++ -c -o adbfs.o adbfs.cpp  
In file included from adbfs.cpp:75:  
./utils.h:37:10: fatal error: 'fuse.h' file not found
#include <fuse.h>
         ^
1 error generated.  
make: *** [adbfs.o] Error 1  

For mac the original fuse project seems depricated and replaced by http://osxfuse.github.io/. I simply installed this and made sure to check "compat mode" to be able to compile a project like this. Reference:

http://stackoverflow.com/questions/20362758/trouble-compiling-fuse-filesystems-on-os-x

So this installation dumps the package config in /usr/local/lib/pkgconfig/fuse.pc but that wasn't on my path so I needed:

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

See:
https://groups.google.com/forum/#!topic/osxfuse-group/Qgt59pwCnWo

After this I could build the project on my mac:

~/dev/projects/adbfs-rootless $ make
c++ -c -o adbfs.o adbfs.cpp -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE -I/usr/local/include/osxfuse/fuse  
c++ -o adbfs adbfs.o -L/usr/local/lib -losxfuse -pthread -liconv  
clang: warning: argument unused during compilation: '-pthread'  
~/dev/projects/adbfs-rootless $

Yey!

Enable USB debugging

  • On phone Settings -> About phone -> Click Build number 7 times.
  • Settings -> Develop options (now appeared) -> enable usb debugging

Mount

Now we can:

mkdir ~/droid  
./adbfs ~/droid

Profit!

About the Author

Viktor Hedefalk

Functional programming devotee. DIY complex.