Skip to content

Instantly share code, notes, and snippets.

@Reiot
Last active November 2, 2022 12:33
Show Gist options
  • Save Reiot/d787a4b319c4d54cbf325183cbe0f9e1 to your computer and use it in GitHub Desktop.
Save Reiot/d787a4b319c4d54cbf325183cbe0f9e1 to your computer and use it in GitHub Desktop.
fix cannot find c++ header in recent mac OS
clang: warning: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
../node_modules/nan/nan.h:50:10: fatal error: 'algorithm' file not found
#include <algorithm>
^~~~~~~~~~~
# install command line tools
> xcode-select --install
> xcrun --show-sdk-path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
# add these lines to .zshrc
export CPATH=`xcrun --show-sdk-path`/usr/include
export CPLUS_INCLUDE_PATH=`xcrun --show-sdk-path`/usr/include/c++/v1
export LIBRARY_PATH=$LIBRARY_PATH:`xcrun --show-sdk-path`/usr/lib:/usr/local/Cellar/gcc/11.2.0_3/lib/gcc/11/lib
# in terminal
export CXXFLAGS="-mmacosx-version-min=10.9"
npm install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment