Could not compile file system watcher for Mac

Hi all,

I’m trying to take advantage of the live reloader – I’m using angular as a front end so it would be nice to have everything reload automatically. However, I am getting the following error – I have installed xcode developer tools etc. So I was basically wondering if anyone knows how to resolve this? I am not quite sure how I can manually run this inside of the dependency so I’m sure this is likely a noob question but would appreciate some help.

Could not compile file system watcher for Mac, try to run "clang -framework CoreFoundation -framework CoreServices -Wno-deprecated-declarations c_src/mac/*.c -o priv/mac_listener" manually inside the dependnecy.

It would be good if you could run it inside the dep, you can probably get more error information that way. Just go into deps/file_system (most likely) and try running that command.

Any news on this? I’m getting an error with the same output.

Thx.

1 Like

I was able to resolve these errors using this:

3 Likes

Hello, facing the same thing on MacOS Mojave 10.14.3.

Xcode command line tools are installed, is there a solution for Mojave?
So far I tried all those above, none works.

Thanks
Oasis

@ewhipp @kenseii
on MacOS 10.14, try open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

3 Likes

Wow that worked, thank you very much.

I runt that command then.
mix do deps.get, deps.compile

then it worked.

2 Likes

To fix it in Catalina, set the correct headers path in .bash_profile:
export SDKROOT="$(xcrun --sdk macosx --show-sdk-path)"

(/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.15.pkg is not available in Catalina).

… and then recompile the deps.

2 Likes

For the users using macOS Big Sur:

  1. Install xcode command line developer tools with xcode-select --install (no need to install xcode)
  2. make sure your clang is pointing to /usr/bin/clang, the headers will be found automatically. (clean your PATH, make sure which clang will output /usr/bin/clang)

When you are using Nix, make sure to check step 2.

Then, run mix deps.compile file_system, everything will be fine.

3 Likes

I just have:

buildInputs = [
  # …
] ++ lib.optionals stdenv.isDarwin [
  darwin.apple_sdk.frameworks.CoreFoundation
  darwin.apple_sdk.frameworks.CoreServices
];

In shell.nix so it will add required headers to the derivation. In that way you do not need to care about whether cc is set to OS provided Clang.

1 Like

As a supplement for @hauleth answer, here’s a complete shell.nix for a normal Phoenix project:

   with (import <nixpkgs> { });
   mkShell {
     buildInputs = [
       beam.packages.erlangR24.elixir_1_12
       nodejs-14_x
     ]
     ++ lib.optionals stdenv.isLinux [
       # For ExUnit Notifier on Linux.
       libnotify

       # For file_system on Linux.
       inotify-tools
     ]
     ++ lib.optionals stdenv.isDarwin ([
       # For ExUnit Notifier on macOS.
       terminal-notifier

       # For file_system on macOS.
       darwin.apple_sdk.frameworks.CoreFoundation
       darwin.apple_sdk.frameworks.CoreServices
     ]);
   }

References:

1 Like