After following the rebar3 workaround there I am seeing the following error:
===> Compiling pc
===> Fetching rebar3_hex ({pkg,<<"rebar3_hex">>,<<"3.1.0">>})
===> Downloaded package, caching at /Users/sam/.cache/rebar3/hex/default/packages/rebar3_hex-3.1.0.tar
===> Compiling rebar3_hex
===> Compiling fs
===> Compiling /Users/sam/phoenix/again3/deps/fs/c_src/mac/cli.c
===> /Users/sam/phoenix/again3/deps/fs/c_src/mac/cli.c:1:10: fatal error: 'getopt.h' file not found
#include <getopt.h>
^
1 error generated.
** (Mix) Could not compile dependency :fs, "/Users/sam/.mix/rebar3 bare compile --paths "/Users/sam/phoenix/again3/_build/dev/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile fs", update it with "mix deps.update fs" or clean it with "mix deps.clean fs"
The comment after the error (recompile / update / clean) didn’t seem to help
Elixir installed via homebrew, version 1.4.0 (erlang 19.2)
Can you compile a C/C++ application that uses getopt? It seems like you are missing some very basic headers that should always be included with xcode. You do have xcode installed too yes (pretty sure I heard that is required when using homebrew, I don’t use Mac’s though ^.^)?
I was able to track the issue down to having swiftenv settings for PATH (swiftenv is a version manager for swift so would make sense it might cause issues with accessing Xcode related files)
Have been able to build and run since, so all good
I’ve tried to remove Xcode and install it from scratch and no luck either. I haven’t touched any includes or library paths that might make this happen.
Got any ideas as to why this might still happening?
18:58:33.406 [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.
In file included from c_src/mac/compat.c:1:
c_src/mac/compat.h:16:10: fatal error: 'CoreServices/CoreServices.h' file not found
#include <CoreServices/CoreServices.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from c_src/mac/main.c:1:
c_src/mac/common.h:4:10: fatal error: 'CoreFoundation/CoreFoundation.h' file not found
#include <CoreFoundation/CoreFoundation.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
My googling of this error points to updating Xcode. Maybe I should try uninstalling Xcode completely and re-installing (?)
Hmmm, seems possibly related to OS 10.14 Mojave, I’m still on 10.13 but I will probably update soon. Can anyone confirm that file_system compiles for them on 10.14?
With xcode and command line tools installed, where xcode would open fine w/o showing license page I still had the issue. Here were my steps:
run open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
get “file not found”
Run xcode-select --install, accept the license agreement and install the (new?) command line tools
run open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
^ NOTE that if you are on a different/future version of mac os you will probably have to change the 10.14 part in the above command to whatever version you’re on.
I am using macOS Ventura 13.1. I am using Nix and setup dev environment using shell.nix. I tried all of the above. None of the solution works. Can someone please help? Here is the errors I get:
==> file_system
In file included from c_src/mac/cli.c:2:
In file included from c_src/mac/cli.h:4:
c_src/mac/common.h:5:10: fatal error: 'CoreServices/CoreServices.h' file not found
#include <CoreServices/CoreServices.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from c_src/mac/compat.c:1:
c_src/mac/compat.h:16:10: fatal error: 'CoreServices/CoreServices.h' file not found
#include <CoreServices/CoreServices.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from c_src/mac/main.c:1:
c_src/mac/common.h:5:10: fatal error: 'CoreServices/CoreServices.h' file not found
#include <CoreServices/CoreServices.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
18:39:43.781 [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 dependency.