utilities, linux, macos, windows 10, windows 11,

How to install bc on Linux macOS and Windows

Mar 19, 2022 · 1 min read · Post a comment

bc or short for basic calculator is almost 50 years old calculator scripting language which I stumble upon as a prerequisite when testing AWS S3 upload speed. Let’s cover the installation basics on the most popular OS platforms.

Prerequisites

  • Shell environment
  • sudo privileges

Example code

bc -l <<< "8*7/3"
18.66666666666666666666

Install bc on Linux

Debian/Ubuntu

sudo apt install -y bc

RHEL/CentOS

sudo yum install -y bc

Fedora 22+

sudo dnf install -y bc

Install bc on macOS

Open Terminal and install bc via Homebrew.

brew install bc

Install bc on Windows

Option 1. There are pre-build binaries of GNU bc usually served from FTP server via HTTPS, HTTP, and FTP.

Option 2. Install Windows Subsystem for Linux (WSL) and install bc by running the Linux command based on the fitting OS distribution.

Conclusion

Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.