Cross-platform FUSE library for Go - Works on Windows, macOS, Linux, FreeBSD, NetBSD, OpenBSD
See the codeCgofuse is a cross-platform FUSE library for Go. It is supported on multiple platforms and can be ported to any platform that has a FUSE implementation. It has cgo, !cgo (aka "nocgo") and FUSE (aka "FUSE2"), FUSE3 variants depending on the platform.
| cgo | !cgo | FUSE | FUSE3 | |
|---|---|---|---|---|
| Windows | ✓ | ✓ | ✓ | |
| macOS | ✓ | ✓ | ||
| Linux | ✓ | ✓ | ✓ | |
| FreeBSD | ✓ | ✓ | ✓ | |
| NetBSD | ✓ | ✓ | ||
| OpenBSD | ✓ | ✓ |
Windows
> set CPATH=C:\Program Files (x86)\WinFsp\inc\fuse
> go install -v ./fuse ./examples/memfs
> set CGO_ENABLED=0
> go install -v ./fuse ./examples/memfs
macOS
$ go install -v ./fuse ./examples/memfs ./examples/passthrough
Linux
$ go install -v ./fuse ./examples/memfs ./examples/passthrough
$ go install -tags=fuse3 -v ./fuse ./examples/memfs ./examples/passthrough
FreeBSD
$ go install -v ./fuse ./examples/memfs ./examples/passthrough
$ go install -tags=fuse3 -v ./fuse ./examples/memfs ./examples/passthrough
$ vi /boot/loader.conf # add: fuse_load="YES"
$ sysctl vfs.usermount=1 # allow user mounts
$ pw usermod USERNAME -G operator # allow user to open /dev/fuse
NetBSD
$ go install -v ./fuse ./examples/memfs ./examples/passthrough
$ chmod go+rw /dev/puffs
$ sysctl -w vfs.generic.usermount=1
OpenBSD
$ go install -v ./fuse ./examples/memfs ./examples/passthrough
kern.usermount option, which allowed non-root users to mount file systems [link]. Therefore you must be root in order to use FUSE and cgofuse.User mode file systems are expected to implement fuse.FileSystemInterface. To make implementation simpler a file system can embed ("inherit") a fuse.FileSystemBase which provides default implementations for all operations. To mount a file system one must instantiate a fuse.FileSystemHost using fuse.NewFileSystemHost.
The full documentation is available at GoDoc.org: package fuse
There are currently three example file systems:
The following software is being used to test cgofuse.
Windows (cgo and !cgo)
macOS
Linux
FreeBSD
Overall
Maintained
Code review
Go module
Latest release
Releases this year
1,795 followers · starred Jun 2018
805 followers · starred Dec 2023
424 followers · starred Jul 2022
182 followers · starred Mar 2022
Cross-platform FUSE library for Go - Works on Windows, macOS, Linux, FreeBSD, NetBSD, OpenBSD
See the codeCgofuse is a cross-platform FUSE library for Go. It is supported on multiple platforms and can be ported to any platform that has a FUSE implementation. It has cgo, !cgo (aka "nocgo") and FUSE (aka "FUSE2"), FUSE3 variants depending on the platform.
| cgo | !cgo | FUSE | FUSE3 | |
|---|---|---|---|---|
| Windows | ✓ | ✓ | ✓ | |
| macOS | ✓ | ✓ | ||
| Linux | ✓ | ✓ | ✓ | |
| FreeBSD | ✓ | ✓ | ✓ | |
| NetBSD | ✓ | ✓ | ||
| OpenBSD | ✓ | ✓ |
Windows
> set CPATH=C:\Program Files (x86)\WinFsp\inc\fuse
> go install -v ./fuse ./examples/memfs
> set CGO_ENABLED=0
> go install -v ./fuse ./examples/memfs
macOS
$ go install -v ./fuse ./examples/memfs ./examples/passthrough
Linux
$ go install -v ./fuse ./examples/memfs ./examples/passthrough
$ go install -tags=fuse3 -v ./fuse ./examples/memfs ./examples/passthrough
FreeBSD
$ go install -v ./fuse ./examples/memfs ./examples/passthrough
$ go install -tags=fuse3 -v ./fuse ./examples/memfs ./examples/passthrough
$ vi /boot/loader.conf # add: fuse_load="YES"
$ sysctl vfs.usermount=1 # allow user mounts
$ pw usermod USERNAME -G operator # allow user to open /dev/fuse
NetBSD
$ go install -v ./fuse ./examples/memfs ./examples/passthrough
$ chmod go+rw /dev/puffs
$ sysctl -w vfs.generic.usermount=1
OpenBSD
$ go install -v ./fuse ./examples/memfs ./examples/passthrough
kern.usermount option, which allowed non-root users to mount file systems [link]. Therefore you must be root in order to use FUSE and cgofuse.User mode file systems are expected to implement fuse.FileSystemInterface. To make implementation simpler a file system can embed ("inherit") a fuse.FileSystemBase which provides default implementations for all operations. To mount a file system one must instantiate a fuse.FileSystemHost using fuse.NewFileSystemHost.
The full documentation is available at GoDoc.org: package fuse
There are currently three example file systems:
The following software is being used to test cgofuse.
Windows (cgo and !cgo)
macOS
Linux
FreeBSD
Overall
Maintained
Code review
Go module
Latest release
Releases this year
1,795 followers · starred Jun 2018
805 followers · starred Dec 2023
424 followers · starred Jul 2022
182 followers · starred Mar 2022