how to compile c++ in terminal mac code example Example: run c++ program in mac terminal g++ sort.cpp -o sort ./sort