Fixing libvterm compilation errors on macOS

If you’ve tried building libvterm on macOS using GCC, chances are you hit some confusing errors about FILE or fpos_t. For example:

gcc/arm64-apple-darwin/14.3.0/include-fixed/stdio.h:81:8: error: unknown type name 'FILE'

Or perhaps:

include-fixed/stdio.h:401:18: note: 'fpos_t' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'

At first glance, it looks like you just forgot to `#include <stdio.h>`. But the culprit is that GCC installed via Nix doesn't work in this case.

The Fix

The simplest solution is: use Clang instead of GCC when building. Tell CMake explicitly to use Clang:

1
(setq vterm-module-cmake-args "-DCMAKE_C_COMPILER=clang")

If you already ran CMake with GCC, you might need to remove your build directory or at least `CMakeCache.txt` first, so the compiler choice is reset.

Cheers!


Last modified on 2025-08-20