Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

How to Install COBOL on MacOS?

  • Last Updated : 21 Sep, 2021

COBOL is a compiled English-like computer programming language designed for business use. It is an imperative, procedural, and, since 2002, object-oriented language. COBOL is primarily used in business, finance, and administrative systems for companies and governments.

In this article, we will look at the process of installing COBOL in MacOS.

Installation Procedure:

Follow the below steps to install COBOL in MacOS:

Step 1: Install Homebrew if it is not installed in your system. Enter system password if required.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

installing homebrew on macos



Step 2: Install the GNU-COBOL using the below brew command:

brew install gnu-cobol

installing cobl in macos

Step 3: Check if it is installed correctly using the below command:

cobc -v

verifying cobol installation on Macos

Hello, wold in COBOL:

Use the below in a new .cbl file and save it inside a folder to run the hello world program.

Cobol




IDENTIFICATION DIVISION.
PROGRAM-ID. HELLOWORD.
  
PROCEDURE DIVISION.
DISPLAY "HELLO WORLD".
STOP RUN.

Now open a terminal inside the folder and enter the following commands to build and run the code:

cobc -x -o hello_world hello_world.cbl
./hello_world

Output:



hello world in cobol

Installing COBOL-IDE:

Prerequisites

Now Enter OpenCobolIDE in Terminal to launch the IDE:

OpenCobolIDE

The IDE should open up as shown below, Click on New File.

Here Enter a name and select OK.

A “Hello World” program should appear by default, Click on RUN to view “Hello World” as Output.

hello world in cobol in COBOL IDE

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!