Skip to content

File watching fails on MacOS Big Sur #767

@Ferossgp

Description

@Ferossgp

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))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions