MacOS – X11/Xlib.h file not found

macosterminalx11xcode

I am trying to install Savi-program for monitoring satellites found here via Terminal. I am developer so I have XCode installed. which gcc returns /usr/bin/gcc. Command make ARCH=macosx once in the directory is the code to execute. However, I am getting an error, saying 'X11/Xlib.h'. Where do I get 'X11/Xlib.h' so that the program installs successfully?

This is the full error:

Mains-MBP:savi1.4.9 mainuser$ make ARCH=macosx
making all in manual...
making all in manual/images...
make[2]: Nothing to be done for `all'.
making all in bin...
make[1]: Nothing to be done for `all'.
making all in maps...
make[1]: Nothing to be done for `all'.
making all in oogl...
make[1]: Nothing to be done for `all'.
making all in data...
make[1]: Nothing to be done for `all'.
making all in tcl...
tclsh mkindex.tcl
making all in src...
making all in src/include...
make[2]: Nothing to be done for `all'.
gcc -O2 -DNO_ZLIB -Wall -Wextra -Wconversion -pedantic -ansi -I./include -I/opt/X11/include   -c -o main.o main.c
In file included from main.c:38:
In file included from ./include/tcl_utils.h:40:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/tk.h:78:11: fatal error: 
      'X11/Xlib.h' file not found
#       include <X11/Xlib.h>
                ^
1 error generated.
make[2]: *** [main.o] Error 1
make[1]: *** [all] Error 2
make: *** [all] Error 2

Best Answer

The instructions you quote tell you exactly what the issue is

When you type make you will be prompted to install Xcode. You can also install Xcode by typing the terminal command xcode-select --install

If your compilation fails with an Xlib not found error, install XQuartz to get X11 headers under /opt/X11, and then type:

CPPFLAGS=-I/opt/X11/include
make ARCH=macosx