How to program Arduino using Xcode on Mac OS

Is it possible to program arduino using Xcode? It says it should run the C++ language, but it looks like it is mostly used for creating apps.
Thank you!

Did you do a search of the forum for Xcode? There is an extensive thread on the subject:

What language does Arduino use? Is it C++?
I am looking for an alternative to the Arduino IDE. At present, I am interested in using Xcode and it can use the C++ language.
Thank you


Xcode is the apple app IDE, I can't see how you would create the hex files for Arduino.

Cross-posts merged.

From the nice link @dannable shared, it looks like it's theoretically possible to do, but maybe won't provide full support.

One option is to enable the File > Preferences > Use external editor option, then use your preference of text editor (which could be XCode) to write the sketches, using the Arduino IDE only to compile, upload, and install libraries. Or if you prefer using the command line, you can do that using Arduino CLI (which is also well suited to integrating into editors and IDEs):

There are some alternative IDEs. I think the Arduino plugin for VS Code is fairly popular but I haven't tried it. Arduino also has an alpha stage "Arduino Pro IDE" if you want to take that for a test drive: