Build your first Command Line Tool through the Xcode user interface.
same as first swift app
-
(tap) Xcode icon > Create New Project > macOS > Command Line Tool
-
in the Xcode editor
New > Create New Project > macOS > Command Line Tool
run the project by terminal
-
open the terminal
-
cdthe direction to find themain.swift -
swift main.swift
run the project in the Xcode
command+ R