Way back when Apple decided to move to OS X, they chose a version of Unix called BSD as a start, BSD translating to "Berkeley Software Distribution". BSD versions of Unix, e.g. FreeBSD, can trace their lineage back to an early version of Unix developed at the University of California at Berkeley.

Apple essentially forked it into an OS called Darwin that was, and still is, freely available, minus the GUI and other proprietary stuff from Apple that make OS X what it is.

"OS X" later got renamed as "macOS" and versions now have names and version numbers appended on the end to distinguish later releases. The most recent version is called "macOS Mojave 10.14.3".

The similarities you see in programs like "Terminal" for macOS and other Unix like operating systems like "Linux", are because both use the same default shell command interpreters, called "BASH".

The advantage of Unix like systems is that they are well established from way back and so are mature. There is a large catalogue of programs accumulated over the years and if they do not transfer directly from one platform to another, they can usually be re-built (compiled) on a new Unix like system by using the common tools inherited by all Unix like systems.

Unix has been used extensively in scientific communities over the years so there is a wealth of old programs that are still useful and may be compiled on later operating systems like macOS. Unix was not reliant on the one type of processor chip running the whole process like "Windows" is, the core Unix operating system would be re-written for each hardware platform it was run on. Any specific programs needed to run on that platform once the core operating systems was installed could usually be compiled from a previous source using the tools common to all Unix systems as mentioned above.

Originally most programs were run from a command line, so everything had to be typed in manually to build and run programs. Of course now Unix systems tend to have a 'GUI' front end which conveniently sits on top of the underlying core operating system, but programs like 'Terminal' allow us to go back to the 'good old days' and run stuff at a lower level. Some GUI applications are still started by a script that runs at the terminal level and just kicks off the GUI part so you don't see the command line - that includes some of the applications described on this site.

Notes on the additional tabs here cover some of the useful commands in macOS used in running and developing Astronomy applications on Mac platforms.

A ".bash_profile" file exists for each user on a macOS based system. It is a file that is read at login and any commands in this "text" file executed, or any additional paths to application folders set up by adding to the $PATH enviroment variable.

As it is user specific, altering it will not affect other user logins. The file is usually hidden in "Finder" but it can be amended with a text editor or using the "Applications/Utilities/Terminal.app". Note the initial values of the $PATH variable are taken from the file "/etc/paths"

On the command line in the "Terminal" app type:
touch ~/.bash_profile; open ~/.bash_profile

This will open the file in "Text Edit" the default system text editor so it can be amended and saved.


An alternate command to edit text files is : sudo nano ~/.bash_profile - Enter password as prompted.

Using nano this file can be edited and then
  • Hit control-x to quit.
  • Enter “Y” to save the modified buffer.
Of course any suitable text file editing app can be used, like BBEdit, as long as the file to edit is viewable in "Finder".

As mentioned above the "/etc/paths" file contains the original system wide base set of paths that are added to the $PATH variable in the shell. Generally would leave this alone and add any required paths at the single user level.

These paths are conveniently listed one per line in this file.
To confirm any changes to $PATH open a Terminal window, and type "echo $PATH" to see the current full path list.

To find a file across your whole drive use "find" in "Terminal", type:

find / -name myfile -print

macOS will search and each occurence it finds will be shown with its full pathname and each result will be shown as a separate entry.

e.g. /usr/library/myfile

find /path/to/folder/ -iname *file_name_portion* The arguments above are as follows: /path/to/folder/ - the folder where to begin searching. If not specified, the search will be started in the current directory. Switches I use: -iname - search for files and folders which contain the specified portion in the name and ignore text case.
An example: Here is an example to find instances of any file containing "gfortran"on the system starting at root. You may need to prefix the command with usual 'sudo' and type in your password if access to some restricted directories is required to include them in the search (we assume here your normal user login has administrator capacity on the Mac platform in use). find / -iname *gfortran* Example:

 



'./' Note on a command line in 'Terminal' typing './filename' will cause the OS to try and run this file in the current directory if it exists and if it is an executable file, e.g. a script file. If the file is in the parent directory (i.e. above) then type '../filename'. Basically supply the path if the file is not in the current $PATH variable list.