You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
github.com/fsnotify/fsevents uses CGO, and I'd really like to avoid using CGO. The main reason for this is that it just makes building applications that depend on fsnotify harder: you will need a C compiler, and cross-compiling from e.g. Linux to macOS – which is easy now – will be very hard as well. We can use some shims and build tags to allow people to use CGO_ENABLED=0 and -tags fsnotify_no_events, but then FSEvents won't be available in that build which would be confusing.
So the path forward on this is that support for FSEvents will have to be added to x/sys/unix first, similar to how illumos/Solaris FEN support was added there before we added support here.
I don't have a macOS machine; just a (slow) QEMU VM. It's kind of hard for me to work on this, and I'm unlikely to work on it in the near future, but this is the path forward to get it properly added to fsnotify. In the meanwhile, people can use github.com/fsnotify/fsevents protected with some build tags if they want, but it's a bit awkward.
Reacted by Ilai Fallach, Nathan Youngman and Laurent Demailly
Falling back from FSEvents to kqueue on macOS would be confusing, that's true. It may work, but it would be confusing to the programmer or end-user compiling the software, and could make bug reports confusing too.
macOS doesn't have the C compiler installed by default, though a developer may not get very far without installing the Xcode Command Line Tools. It's been a while since I've done a fresh install, but I feel like it didn't take long after installing the Homebrew package manager before I had to get a C compiler installed too.
Cross-compiling seems like a more significant issue. Zig has been innovating in that space by bundling libc and a C/C++ compiler, but that could be a difficult proposal to sell for Go.
I don't expect that'll change any time soon, if ever, and even if it did, I wouldn't be hugely interested to pick this up either to be honest. It's a comparatively big project: we're talking about a full week, maybe even two weeks of of full-time work? Even going with the existing cgo solution would need quite a bit of attention to get it up to spec.
But spending so much of my free time on something I'll never personally see the benefits of is kind of where I draw the line. That doesn't mean I wouldn't like to see support for it, or don't want to spend any time on it, but it'll have to be like the illumos/FEN stuff, where nshalman did the bulk of the work and I just helped out where I could, or something like that.
Activity
nathany commentedon Dec 13, 2014
Work has begun on this as an external project that can eventually be used from fsnotify.
https://github.com/go-fsnotify/fsevents
TODO:
nathany commentedon Apr 20, 2016
samjacobson commentedon Apr 21, 2016
nathany commentedon Apr 21, 2016
nathany commentedon Apr 21, 2016
[-]FSEvents on OS X[/-][+]FSEvents on macOS[/+]abuchanan-nr commentedon Jan 11, 2019
PeterBocan commentedon Jan 21, 2019
Timmmm commentedon Jan 23, 2019
1 remaining item
ysweid commentedon May 21, 2019
nathany commentedon Oct 5, 2019
joeljeske commentedon Jun 5, 2020
Any idea on what the plan would be for incorporating FSEvents? Were issues found in the experimentation?
What can the community do at this point to help move this cause?
arp242 commentedon Oct 14, 2022
github.com/fsnotify/fsevents uses CGO, and I'd really like to avoid using CGO. The main reason for this is that it just makes building applications that depend on fsnotify harder: you will need a C compiler, and cross-compiling from e.g. Linux to macOS – which is easy now – will be very hard as well. We can use some shims and build tags to allow people to use CGO_ENABLED=0 and -tags fsnotify_no_events, but then FSEvents won't be available in that build which would be confusing.
So the path forward on this is that support for FSEvents will have to be added to x/sys/unix first, similar to how illumos/Solaris FEN support was added there before we added support here.
I don't have a macOS machine; just a (slow) QEMU VM. It's kind of hard for me to work on this, and I'm unlikely to work on it in the near future, but this is the path forward to get it properly added to fsnotify. In the meanwhile, people can use github.com/fsnotify/fsevents protected with some build tags if they want, but it's a bit awkward.
srlehn commentedon Nov 4, 2022
github.com/ebitengine/purego could be used to skirt the usage of cgo.
nathany commentedon Dec 3, 2023
Falling back from FSEvents to kqueue on macOS would be confusing, that's true. It may work, but it would be confusing to the programmer or end-user compiling the software, and could make bug reports confusing too.
macOS doesn't have the C compiler installed by default, though a developer may not get very far without installing the Xcode Command Line Tools. It's been a while since I've done a fresh install, but I feel like it didn't take long after installing the Homebrew package manager before I had to get a C compiler installed too.
Cross-compiling seems like a more significant issue. Zig has been innovating in that space by bundling libc and a C/C++ compiler, but that could be a difficult proposal to sell for Go.
@arp242 Are you still without a dedicated Mac?
arp242 commentedon Dec 3, 2023
I don't expect that'll change any time soon, if ever, and even if it did, I wouldn't be hugely interested to pick this up either to be honest. It's a comparatively big project: we're talking about a full week, maybe even two weeks of of full-time work? Even going with the existing cgo solution would need quite a bit of attention to get it up to spec.
But spending so much of my free time on something I'll never personally see the benefits of is kind of where I draw the line. That doesn't mean I wouldn't like to see support for it, or don't want to spend any time on it, but it'll have to be like the illumos/FEN stuff, where nshalman did the bulk of the work and I just helped out where I could, or something like that.
frou commentedon Aug 17, 2025
Related: The watchexec project wrote about how FSEvents is a bit dodgy and they prefer kqueue after all: https://watchexec.github.io/docs/macos-fsevents.html