{"record":{"id":"6a3877f8c1c82f86","repo":"EugenMayer/docker-sync","slug":"fswatch-is-not-expected-to-run-on-platforms-other","errorCode":null,"errorMessage":"Fswatch is not expected to run on platforms other then MacOS","messagePattern":"Fswatch is not expected to run on platforms other then MacOS","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/docker-sync/dependencies/fswatch.rb","lineNumber":21,"sourceCode":"    module Fswatch\n      UNSUPPORTED = 'Fswatch is not expected to run on platforms other then MacOS'\n\n      def self.available?\n        forbid! unless Environment.mac?\n        return @available if defined? @available\n        @available = find_executable0('fswatch')\n      end\n\n      def self.ensure!\n        return if available?\n\n        PackageManager.install_package('fswatch')\n        puts \"please restart docker sync so the installation of fswatch takes effect\"\n        exit(1)\n      end\n\n      def self.forbid!\n        raise UNSUPPORTED\n      end\n    end\n  end\nend\n","sourceCodeStart":3,"sourceCodeEnd":26,"githubUrl":"https://github.com/EugenMayer/docker-sync/blob/4eab6de164d44c724c739c17bd574efa9008aae1/lib/docker-sync/dependencies/fswatch.rb#L3-L26","documentation":"Dependencies::Fswatch.available? starts with 'forbid! unless Environment.mac?' (lib/docker-sync/dependencies/fswatch.rb:7), and forbid! raises UNSUPPORTED. The fswatch file watcher is treated as macOS-only, so probing or ensuring that dependency on Linux or Windows aborts with this error instead of returning false. It is reached directly via watch_strategy: fswatch, and indirectly because the rsync sync strategy's default watch strategy is fswatch (default_watch_strategy, project_config.rb:153).","triggerScenarios":"Running docker-sync on a non-macOS host where any sync has watch_strategy: fswatch, or sync_strategy: rsync with no explicit watch_strategy (its default resolves to fswatch); also any direct call to Dependencies::Fswatch.available? or ensure! off macOS.","commonSituations":"A config authored on a Mac executed on a Linux CI runner or a teammate's Linux machine; macOS tutorials pasted into Linux setups; docker-toolbox-era rsync plus fswatch combinations.","solutions":["On non-macOS hosts, set an explicit watch_strategy: dummy (or unison) on every rsync sync so the fswatch default is never used.","Prefer sync_strategy: native on Linux; its default watch strategy is dummy and no fswatch probe happens.","Keep rsync plus fswatch configs on macOS machines only, and exclude them from Linux CI.","Guard any direct Fswatch.available?/ensure! call with a host_os darwin check."],"exampleFix":"# before (runs on Linux; fswatch is macOS-only)\nsyncs:\n  appcode-sync:\n    src: './src'\n    sync_strategy: 'rsync'   # default watcher for rsync is fswatch -> raises\n\n# after\nsyncs:\n  appcode-sync:\n    src: './src'\n    sync_strategy: 'rsync'\n    watch_strategy: 'dummy'","handlingStrategy":"type-guard","validationCode":"# pick the watcher per OS before building options\nmac = RbConfig::CONFIG['host_os'].include?('darwin')\noptions['watch_strategy'] = mac ? 'fswatch' : 'dummy'","typeGuard":"def fswatch_supported?\n  RbConfig::CONFIG['host_os'].include?('darwin')\nend","tryCatchPattern":"begin\n  DockerSync::Dependencies::Fswatch.available?\nrescue RuntimeError => e\n  raise unless e.message == DockerSync::Dependencies::Fswatch::UNSUPPORTED\n  # non-mac host: select another watch strategy instead\nend","preventionTips":["Never hardcode watch_strategy: fswatch in configs shared across operating systems.","Leave watch_strategy unset where possible so per-OS defaults apply.","Prefer sync_strategy: native on Linux.","Run shared configs on the same OS family as CI."],"tags":["docker-sync","fswatch","macos","linux","platform-support","ruby"],"backgroundTag":"unsupported-platform","analyzedSha":"4eab6de164d44c724c739c17bd574efa9008aae1","analyzedAt":"2026-08-23T10:20:11.101Z","schemaVersion":2},"datasetVersion":"2026-08-23T13:39:53.451Z"}