Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File watching fails on MacOS Big Sur #767

Closed
Ferossgp opened this issue Aug 3, 2020 · 5 comments
Closed

File watching fails on MacOS Big Sur #767

Ferossgp opened this issue Aug 3, 2020 · 5 comments

Comments

@Ferossgp
Copy link

Ferossgp commented Aug 3, 2020

Hawk does not work with macOS 11

More discussion here bhauman/figwheel-main#253

Temporary solution bhauman/figwheel-main#253 (comment)

(ns build
  (:require [shadow.cljs.devtools.api :as shadow]))

;; Patch hawk for macOS Big Sur
;; hawk can't find the carbon lib any more, so the underlying barbary watcher
;; doesn't work for getting OS-level file change events. We have to fall back to
;; polling by monkey-patching the barbary-vending multimethod for now.
(import [hawk SensitivityWatchEventModifier])
(require '[hawk.watcher])
(defmethod hawk.watcher/new-watcher :barbary [_]
  (prn "WARN - falling back to filesystem polling on macOS")
  (let [sensitivity SensitivityWatchEventModifier/HIGH]
    (hawk.PollingWatchService. sensitivity)))

(defn watch
  {:shadow/requires-server true}
  [& args]
  (shadow/watch :dev))
@thheller
Copy link
Owner

thheller commented Aug 3, 2020

You can set :fs-watch {:hawk false} in shadow-cljs.edn to "fix" it.

I'm waiting for the final release of Big Sur to see if the problem persists before removing hawk. It is only used because file watching on macOS is otherwise slower than some people prefer.

rgm added a commit to rgm/BarbaryWatchService that referenced this issue Aug 4, 2020
Mac OS 11 (aka. "Big Sur") made some changes to the way that the Carbon
library is located, causing JNA calls to fail. This has been fixed in
JNA 5.6.0; see java-native-access/jna#1216

Since Barbary is implemented on JNA, this is causing downstream projects
that rely on file watching to crash on JVM start when used on Mac OS 11.

Examples:
- bhauman/figwheel-main#253
- thheller/shadow-cljs#767
@thheller
Copy link
Owner

Can anyone confirm that this is still an issue on macOs Big Sur final?

@rlhk
Copy link

rlhk commented Nov 13, 2020

Just upgraded to the final version few hours ago. No issue noticed so far.

@mhuebert
Copy link

I've got shadow-cljs running on Big Sur / M1 / openjdk 15 with no issues.

@Ferossgp
Copy link
Author

@thheller works for me after upgrade to the latest macOS release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants