install codeblocks on ubuntu

How to Install CodeBlocks on Ubuntu 22.04 LTS

In this article, we’ll cover how to install CodeBlocks on Ubuntu. Continue reading this guide to find out how you can set up CodeBlocks to write, compile and execute programs. So, let’s get started!

CodeBlocks Overview

CodeBlocks is an interactive, highly extensible IDE for programmers. It is an open-source development environment for high-level languages like C and C++. In addition, it provides a plugin system, supports several compilers, and provides debugging functionality.

CodeBlocks Features

Some great features of CodeBlocks are:

  • Several plugins to extend the IDE use
  • Intelligent indentation while writing the code
  • The class browser and tabbed interface 
  • Code folding and syntax highlighting 
  • Faster and consumes fewer MBs of RAM
  • Supports multiple workspaces and multi-target project dependencies within the same workspace
  • Easier to install and simple to use for beginners


For this article, you’ll need the following:

  • A Ubuntu machine with sudo access or root privilege
  • gcc or g++ compiler installed on the system

How to Install CodeBlocks on Ubuntu

Here we will discuss different methods to install CodeBlocks on Ubuntu. We’ll also discuss how to open and run this open-source IDE. 

Install CodeBlocks From the Terminal

In this section, we’ll look at how you can install CodeBlocks from the terminal.

Update the System

The first step is to update the Ubuntu machine. Open the Terminal by pressing “Ctrl + Alt + T”. After that, update the apt package using the install command. Specifically, type:

Sudo apt update && sudo apt upgrade

The output should look something like this:

update ubuntu

Next, install the gcc and g++ compilers:

sudo apt install g++
sudo apt install gcc

Wait for the installation to complete before proceeding to the next step.

Install CodeBlocks on Ubuntu

Most of the package managers are already updated in the APT system repository. Hence, we’ll use that repository to install CodeBlocks. For this step, we’ll use the apt install command as shown below:

sudo apt install codeblocks

On the other hand, you can also install the CodeBlocks using the Debian package. For this step, first, get the package using the wget command. For example:



install codeblocks

Wait for the download to complete. Next, run the command given below to extract and launch the downloaded package:

sudo dpkg -i codeblocks_20.03-3.1_amd64.deb

The installation will start as soon as you execute this command. The output should look something like this:

install codeblocks on ubuntu

The third option is to use the PPA repositories in case APT, and Debian packages don’t work on the Ubuntu machine. First, add the PPA repository in the APT package manager as shown below:

sudo add-apt-repository PPA:codeblocks-devs/release


install codeblocks

After that, execute the install command:

sudo apt install codeblocks

Install CodeBlocks Plugins

CodeBlocks offers a wide array of plugins that helps with programming. One of them is the contrib plugin. We’ll install that as well. Specifically, type:

sudo apt install codeblocks-contrib

Install CodeBlocks Using Software Manager

Alternatively, we can also install CodeBlocks using the GUI Software Manager application. This method is also beginner friendly. 

Open Ubuntu Software Manager

From the Ubuntu Dock, click Ubuntu Software. Next, type CodeBlocks in the search bar. Locate the IDE from the search result and click to open it. 

Once the details page appears, click the Install button to add the CodeBlocks on Ubuntu. 

Install CodeBlocks Using Flatpak

If the above two methods don’t work, then Flatpak is the last option we can use to install CodeBlocks on Ubuntu. Flatpak is a universal package manager that we can use to easily install the system repository. 

Install Flatpak

To use Flatpak for CodeBlocks, we’ll first install using the install command. Specifically, type:

sudo apt install flatpak

We’ll also add its FlatHub repository from its official website. For this step, we’ll use the remote-add command. Specifically, type:

sudo flatpak remote-add --if-not-exists flathub

Once the repository has been downloaded, we’ll restart the machine to integrate Flatpak properly. For this step, we’ll use the reboot command:

sudo reboot

Install CodeBlocks Using Flatpak

Now, we’ll run the following commands in the Terminal to install CodeBlocks IDE on Ubuntu:

sudo flatpak install flathub org.codeblocks.codeblocks

How to Run, Update and Remove CodeBlocks on Ubuntu

In this section, we’ll cover how you can successfully launch the CodeBlocks application once you’ve installed it. We’ll also cover how to update and remove this IDE. 

Run CodeBlocks on Ubuntu

Once we’ve successfully installed the CodeBlocks, we can launch it through the Terminal and the Application Manager. To launch it using the Terminal, type the codeblocks command in the Terminal. Specifically, type:

codeblocks &

You should get a dialogue box asking for the default compiler as shown below:

launch codeblocks

Choose the one you prefer and hit the OK button.


codeblocks home page

To launch it using the Applications tab, click the Applications Manager. After that, type CodeBlocks in the search bar. Lastly, hit Enter key to launch it. 


codeblocks from Applications Manager

Update CodeBlocks on Ubuntu

To update the CodeBlocks application, use the update command. For instance, type:

# for APT package
sudo apt update && sudo apt upgrade
# For Flatpak package
sudo flatpak update

Alternatively, we can also update using the GUI option. For this, open the Software Manager. Next, locate CodeBlocks and click on it. In the new window, locate the update button and click on it. However, this button is only visible if any official update is available in the system. 

Uninstall CodeBlocks from Ubuntu

To remove CodeBlocks from Ubuntu, use the autoremove or uninstall command. For example, for the APT package, type:

sudo apt autoremove --purge codeblocks

For the Flatpak package, use the uninstall command:

flatpak uninstall --delete-data org.codeblocks.codeblocks

Once it has been completed, remove the residual files too. For this step, use the remove command. For example:

flatpak remove --unused

And that’s a wrap. This tutorial covered how we can install CodeBlocks on Ubuntu using the APT package, Debian package, and PPA packages. We also discussed how to install it using the GUI Software manager and Flatpak packages. Lastly, we looked at how to run, update and delete this IDE. 

Although CodeBlocks is a well-known IDE, it isn’t as famous as Visual Studio code. However, it is an excellent choice for C and C++ programs. For more information, you can check CodeBlocks official page.

If you liked this article, please share it.

Related Posts