I added my /usr/local/bin and /opt/homebrew/include to my CPATH variable. This way the clang compiler recognizes libraries residing in these paths when invoked from command line. However, when I am to develop something in Xcode, Xcode (12.5.1) doesn't recognize these paths unless explicitly added to Xcode project settings. As you may have experienced, doing so is really troublesome.

I want these paths added to CPATH to be globally available to all C/C++ projects in Xcode in Big Sur (11.6) M1 Macs without having to explicitly add them in each project settings.

Is it possible?

  • This may be what you are looking for: apple.stackexchange.com/q/106355/30895.
    – Martin R
    Sep 19 at 10:07
  • @MartinR Thanks but I need an up-to-date explanation.
    – nmd_07
    Sep 19 at 11:00
  • 1
    Really you don't want this you need to control by project. Also your first sentence is confusing - libraries are in neither of those directories. header files will be in the latter.
    – mmmmmm
    Sep 19 at 12:04
  • My general experience in C programmimg is that you want all your environment information in your build scripts and no in your environment as you can't show whet was used to build the code. (Given how Apple have removed the easy setting of environment variables seems to be their choice as well)
    – mmmmmm
    Sep 19 at 12:25
  • @mmmmmm Can you show an example of how a build script for a C/C++ Xcode project should be? Never done it before.
    – nmd_07
    Sep 19 at 12:58

You must log in to answer this question.

Browse other questions tagged .