CPL

CPL-on-Macintosh howto

Apple macOS or OS X is a proprietary unix operating system, derived from the old BSD unix, and has all the requirements for CPL tools and programs to run natively on it. However the classical unix programming tools are not part of the base system, but they are offered by Apple as a separate Xcode development environment. In addition, although Xcode includes a compiler named gcc, this is an Apple-modified version (also known as clang) and lacks some gcc extensions used by CPL. Unmodified gcc can be installed through a third-party package manager such as Homebrew. Hence come the following

Step by step instructions to use CPL on Apple macOS.

(partly modelled after https://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/)

1 - Open a terminal:
If you do not already have the terminal icon in your Dock, enter terminal in the search box and click terminal.app.
2 - Install Command Line Tools:

In a terminal paste and execute:

xcode-select --install

A dialog box will pop up asking if you want to install the Command Line Developer Tools. Accept. If the box does not appear, you probably have them already. Alternately you can install the full Xcode development environment from the App Store, but only do so if you want this much larger package for its own purposes.

3 - Install the Homebrew package manager:
Follow instructions on the brew.sh website.
4 - Install original gcc (the one provided by Apple is an alias for their own clang):
brew install gcc
5 - Download and unpack the CPL archive, with the CC environment variable pointing at the brew-installed C compiler (currently named gcc-10):
curl -fsS -o /tmp/unpack-cpl.sh https://CPLcode.net/version-archive/unpack-cpl.sh && CC=gcc-10 sh /tmp/unpack-cpl.sh
6 - To activate CPL graphics, install gnuplot. You can do it via Homebrew:
brew install gnuplot

or alternately you can find contributed OS X binaries on the official gnuplot site.

You are all set! Please notice that you may have to repeat steps 2 and 4 after a macOS system update. However, you only need to perform this procedure at all if you want to edit, compile or interpret a CPL program. A macOS-compiled CPL executable just runs on bare macOS (with the addition of gnuplot if wanted).

copied.