在 运行 混合 phx.server 时找不到可执行文件 `mac_listener`

Can't find executable `mac_listener` while running mix phx.server

Mac 侦听器无法在 Macos Mojave 上找到,尽管它已安装。 我尝试重新编译依赖并重新安装模块,但问题仍然存在。

混deps.compilefile_systemreturns这个错误。

mix deps.compile file_system

14:34:40.227 [info]  Compiling file system watcher for Mac...
==> file_system
c_src/mac/cli.c:1:10: fatal error: 'getopt.h' file not found
#include <getopt.h>
         ^~~~~~~~~~
1 error generated.

14:34:40.469 [error] 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.

最后的解决方案是这样的。

第一个

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

然后

mix do deps.get, deps.compile