The command line interface is an alternate method of interacting with macOS and Mac OS X, relying on text based command entry to execute commands and perform tasks. It is accessed on the Mac by using the Terminal application. Mac OSX Server Command-Line Administration For Version 10.3 or Later 034-2454Cvr 10/15/03 11:47 AM Page 1. You can use the chmod command to indicate that the text file is executable (that is, its contents can be run as a shell script). In the Terminal app on your Mac, use the cd command to move into the directory that contains the file you want to make executable. For example:% cd YourScriptDirectory. Enter the chmod command. Terminal (in your /Applications/Utilities folder) is the default gateway to that command line on a Mac. With it, instead of pointing and clicking, you type your commands and your Mac does your.
Terminal User Guide
Shell scripts must be executable files in order to run. You can use the chmod command to indicate that the text file is executable (that is, its contents can be run as a shell script).
In the Terminal app on your Mac, use the cd command to move into the directory that contains the file you want to make executable. For example:
Enter the chmod command. For example:
% chmod 755 YourScriptName.sh
After making the shell script file executable, you can run it by entering its pathname. For example:
Mac Command Line List
or
% cd ~/Documents/Dev/
% ./YourScriptName.sh
Command Line For Mac Os X 10.13
There are a few ways to determine what version of OSX you are on.
In the GUI, you can easily click the Apple menu () at the top left of your screen, and choose About This Mac. The version of OS X will be printed underneath the large bold Mac OS X title. Clicking on the Version XYZ text will reveal the Build number.
If you're writing a script though, you may wish to access this programmatically. There are several ways:
System Profiler
sw_vers
Mac OS X user defaults system
Os X Command Line
Command Line On Mac
There are further options but they are not as optimized and simple to use. These should be sufficient!