In this tutorial, we will show you how to install Code::Blocks on Ubuntu via the Terminal.
Prerequisites
- For this tutorial, you’re going to need an Ubuntu system. This tutorial will work on any Ubuntu version, including Ubuntu 22.04. As well as other distros that are based on Ubuntu.
- Root (sudo) access
- A basic understanding of the Terminal/bash. Code::Blocks can also be installed using the GUI. Just search for “Code::Blocks” in the software center and follow the steps.
Step 1: Update your system
The first step is always to update your Ubuntu system. You can do that by running these 2 commands:
sudo apt update sudo apt upgrade
Step 2: Install Code::Blocks and other necessary packages
You’ll need the GCC compiler. If you don’t already have it installed, you can install it by running:
sudo apt install g++
Code::Blocks is available in the Ubuntu Universe repositories. If they are not already added, you can add them by running:
sudo add-apt-repository universe
And then you can go straight to installing Code::Blocks by running:
sudo apt install codeblocks codeblocks-contrib
This will install Code::Blocks and the “codeblocks-contrib” package, enabling you to use plugins on your IDE.
Step 3: Run Code::Blocks
After installing it, a Code::Blocks icon should be available in your applications list. You can also just search for it. If not, you can run it with the following command from the terminal:
codeblocks &
The first time you run Code::Blocks on Ubuntu, you’ll get asked what compiler to use. You can select and use the GNU GCC Compiler that we installed in step 2.
And that’s it. You’ve installed Code::Blocks on Ubuntu! You can now start using it.
How to Uninstall/Remove Code::Blocks from Ubuntu
If you want to uninstall Code::Blocks, you can do so by running the following command:
sudo apt autoremove --purge codeblocks
This will remove Code::Blocks and all its data from your system.
You can learn more about Code::Blocks and other IDEs in our roundup.