Install it by:

sudo yum install centos-release-scl
sudo yum install devtoolset-4

The first command installs and enables Software Collections Repository on your CentOS machine. That repository provides the devtoolset package.

Answer from 13dimitar on Stack Exchange
🌐
Softwarecollections
softwarecollections.org › en › scls › rhscl › devtoolset-4
Devtoolset-4 — Software Collections
devtoolset-4 - Developer Toolset is designed for developers working on CentOS or Red Hat Enterprise Linux platform.
Discussions

How to install devtoolset-4 on RHEL Workstation 7.2?
Good morning I`m a fresh new user of RHEL, I have some problems to install the python`s package devtoolset. Up to now I have tried with # yum install devtoolset-4 which is the way suggested in all guide I have found. But I get the message: No package devtoolset-4 available. More on community.unix.com
🌐 community.unix.com
0
0
August 9, 2016
linux - How to permanently enable newer version of software installed from SCL repo? - Unix & Linux Stack Exchange
On CentOS 6.4: I installed a newer version of devtoolset (1.1) and was wondering how I would go about permanently setting these to be default. Right now, when I ssh into my server running CentOS 6, I More on unix.stackexchange.com
🌐 unix.stackexchange.com
December 25, 2014
Devtoolset is a game changer for C++ development on Linux

what is devtoolset ?

More on reddit.com
🌐 r/cpp
31
20
March 23, 2018
devtoolset-4-gcc* not available for CentOS 7.9
root@cafy-2:shreyash$ sudo yum install devtoolset-4-gcc* Loaded plugins: fastestmirror, langpacks, product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. More on community.cisco.com
🌐 community.cisco.com
July 13, 2021
🌐
Centos
cbs.centos.org › koji › buildinfo
devtoolset-4-gcc-5.3.1-6.1.el7 | Build Info | CentOS Community Build Service
May 16, 2016 - Main Site Links: · Summary · Packages · Builds · Tasks · Build Targets · Users · Hosts · Reports · Search
🌐
Abysm
blog.abysm.org › 2016 › 03 › installing-developer-toolset-rhel-based-distributions
Installing Developer Toolset on RHEL-based Distributions · Kuan-Yi Li's Blog
March 25, 2016 - yum install devtoolset-4 · yum install devtoolset-3 · Say you want to use Developer Toolset 8, you can run · scl enable devtoolset-10 bash · to invoke a BASH shell with environment variables setup to run Developer Toolset 10, check it yourself with · gcc --version ·
🌐
Docker Hub
hub.docker.com › r › centos › devtoolset-4-toolchain-centos7
centos/devtoolset-4-toolchain-centos7 - Docker Image
Developer Toolchain is part of the Red Hat Software Collections and the Toolchain is a subset of tools usable for building C and C++ applications. Docker container based on Red Hat Software Collection packages is available as rhscl/devtoolset-4-toolchain-rhel7 in registry.access.redhat.com.
🌐
GitHub
github.com › sclorg › devtoolset-container › blob › master › 4-toolchain › Dockerfile.rhel7
devtoolset-container/4-toolchain/Dockerfile.rhel7 at master · sclorg/devtoolset-container
May 7, 2025 - Devtoolset container images based on Red Hat Software Collections, that provide a platform for building and running C and C++ applications. Users can choose between Red Hat Enterprise Linux, Fedora, and CentOS based images.
Author   sclorg
Find elsewhere
🌐
Unix Community
community.unix.com › linux and unix-like › red hat
How to install devtoolset-4 on RHEL Workstation 7.2? - Red Hat - Unix Linux Community
August 9, 2016 - Good morning Im a fresh new user of RHEL, I have some problems to install the pythons package devtoolset. Up to now I have tried with # yum install devtoolset-4 which is the way suggested in all guide I have found. B…
Top answer
1 of 5
93

In your ~/.bashrc or ~/.bash_profile Simply source the "enable" script provided with the devtoolset. For example, with the Devtoolset 2, the command is:

source /opt/rh/devtoolset-2/enable

or

source scl_source enable devtoolset-2

Lot more efficient: no forkbomb, no tricky shell

2 of 5
17

An alternative of source /opt/rh/devtoolset-4/enable is

source scl_source enable devtoolset-4

The above shell script scl_source is more elegant than using a hard coded path (may be different on another machine). However scl_source does less because /opt/rh/devtoolset-4/enable uses scl_source and other stuff.

To use scl_source you may have to upgrade package scl-utils

yum update scl-utils  # old scl-utils versions miss scl_source

Quick copy-paste

echo 'source scl_source enable devtoolset-4' >> ~/.bashrc
    # Do not forget to change the version ↑

Source code for curious people

An example of scl_source source code:
https://gist.github.com/bkabrda/6435016

The scl_source installed on my Red Hat 7.1

#!/bin/bash

_scl_source_help="Usage: source scl_source <action> [<collection> ...]

Don't use this script outside of SCL scriptlets!

Options:
    -h, --help    display this help and exit"

if [ $# -eq 0 -o $1 = "-h" -o $1 = "--help" ]; then
    echo "$_scl_source_help"
    return 0
fi


if [ -z "$_recursion" ]; then
    _recursion="false"
fi
if [ -z "$_scl_scriptlet_name" ]; then
    # The only allowed action in the case of recursion is the same
    # as was the original
    _scl_scriptlet_name=$1
fi
shift 1

if [ -z "$_scl_dir" ]; then
    # No need to re-define the directory twice
    _scl_dir=/etc/scl/conf
    if [ ! -e $_scl_dir ]; then
        _scl_dir=/etc/scl/prefixes
    fi
fi

for arg in "$@"; do
    _scl_prefix_file=$_scl_dir/$arg
    _scl_prefix=`cat $_scl_prefix_file 2> /dev/null`
    if [ $? -ne 0 ]; then
        echo "Can't read $_scl_prefix_file, $arg is probably not installed."
        return 1
    fi

    # First check if the collection is already in the list
    # of collections to be enabled
    for scl in ${_scls[@]}; do
        if [ $arg == $scl ]; then
            continue 2
        fi
    done

    # Now check if the collection isn't already enabled
    /usr/bin/scl_enabled $arg > /dev/null 2> /dev/null
    if [ $? -ne 0 ]; then
        _scls+=($arg)
        _scl_prefixes+=($_scl_prefix)
    fi;
done

if [ $_recursion == "false" ]; then
    _i=0
    _recursion="true"
    while [ $_i -lt ${#_scls[@]} ]; do
        _scl_scriptlet_path="${_scl_prefixes[$_i]}/${_scls[$_i]}/${_scl_scriptlet_name}"
        source "$_scl_scriptlet_path"
        if [ $? -ne 0 ]; then
            echo "Can't source $_scl_scriptlet_name, skipping."
        else
            export X_SCLS="${_scls[$_i]} $X_SCLS"
        fi;
        _i=$(($_i+1))
    done
    _scls=()
    _scl_prefixes=()
    _scl_scriptlet_name=""
    _recursion="false"
fi
🌐
Linux @ CERN
linux.web.cern.ch › devtoolset
Developer Toolset - Linux @ CERN
$ scl enable devtoolset-1.1 bash $ gcc --version gcc (GCC) 4.7.2 20121015 (Red Hat 4.7.2-5) Copyright (C) 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions.
🌐
Reddit
reddit.com › r/cpp › devtoolset is a game changer for c++ development on linux
r/cpp on Reddit: Devtoolset is a game changer for C++ development on Linux
March 23, 2018 -

On Linux the dependency on system compilers have always been frustrating since it means your stuck with ancient GCC versions. But I must say I'm very impressed with devtoolset for RHEL/CentOS, it means you can use gcc-7 on old crappy RHEL6 that so many large companies insist on using. And you can ship the resulting binaries and it will run on plain vanilla RHEL installations!

Top answer
1 of 5
12

what is devtoolset ?

2 of 5
6

devtoolset-7 also provides newer versions of lots of supporting debug and performance tools like gdb.

They (RH or Centos) also provide containerised versions of the build tools and the performance tools.

There is also a tech preview of the llvm-toolset, admittedly at clang v4 but still able to build those compatible binaries.

Note that you want to build using a host that is lower or same version as your minimum target version.

e.g. toolset-7 on host centos v6.7 will create bins compatible with 6.7, 6.9 and 7.x If your host is say centos 7.2 toolset-7 builds are only guaranteed to be compatible with v7.2+ targets.

Redhat's documentation is really good (and you can even get a free developer login to access more resources).

Also note that Centos provides similar options to RHEL.

The only downside is I don't think you can use the new ABI variant of CXX LIB as the ABI isn't compatible with older compilers like the default Centos gcc 4

Not really a problem as you can still use the C++11/14/17 features, just a few items are incompatible (such as list::size() still being O(n) and not const time, or strings still being COW)

https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/ (Lots of other tools/langs etc there too like Go,Rust,Python3 and lots of database updated versions etc.)

Not sure if you need to have a developer account, but an example of the documentation: https://access.redhat.com/documentation/en-us/red_hat_developer_toolset/7/html/7.0_release_notes/dts7.0_release

🌐
Cisco Community
community.cisco.com › t5 › tools › devtoolset-4-gcc-not-available-for-centos-7-9 › td-p › 4431796
Solved: devtoolset-4-gcc* not available for CentOS 7.9 - Cisco Community
July 13, 2021 - root@cafy-2:shreyash$ sudo yum install devtoolset-4-gcc* Loaded plugins: fastestmirror, langpacks, product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register.
🌐
Devtoolset
devtoolset.net
DevToolset: Open-Source Database-free Developer Tools Navigator
Find Every Essential Developer Tools You Need For Your Development Journey
🌐
Red Hat
docs.redhat.com › en › documentation › red_hat_developer_toolset › 12 › html › user_guide › chap-red_hat_developer_toolset
Chapter 1. Red Hat Developer Toolset | User Guide | Red Hat Developer Toolset | 12 | Red Hat Documentation
For detailed instructions on how ... 1.4, “Getting Access to Red Hat Developer Toolset”. ... Before installing Red Hat Developer Toolset, install all available Red Hat Enterprise Linux updates. To install all components that are included in Red Hat Developer Toolset, install the devtoolset-12 ...
🌐
Upenn
hpcwiki.pmacs.upenn.edu › index.php › HPC:Developer_Tool_Set
HPC:Developer Tool Set - HPC wiki
devtoolset-2-gcc-4.8.0-5 devtoolset-2-libstdc++-devel-4.8.0-5 devtoolset-2-runtime-2.0-14 devtoolset-2-gdb-7.6-28 devtoolset-2-libquadmath-devel-4.8.0-5 devtoolset-2-gcc-gfortran-4.8.0-5 devtoolset-2-gcc-c++-4.8.0-5 devtoolset-2-binutils-2.23.52.0.1-5
🌐
Red Hat
docs.redhat.com › en › documentation › red_hat_developer_toolset › 10 › html-single › user_guide › index
User Guide | Red Hat Developer Toolset | 10 | Red Hat Documentation
The binutils provide many binary tools other than a linker and an assembler. For a complete list of these tools, see Table 4.1, “Tools Included in binutils for Red Hat Developer Toolset”. To execute any of the tools that are a part of binutils: $ scl enable devtoolset-10 'tool option ...
🌐
Rocky Linux Forum
forums.rockylinux.org › rocky linux help & support
Devtoolset for Rocky Linux - Rocky Linux Help & Support - Rocky Linux Forum
September 9, 2021 - So we can use “Development Tools” from future e.g. Rocky 10.4 on Rocky 8.4 without upgrading the OS. – devtoolset: GNU Compiler Collection, GNU Debugger, and other development, debugging, and performance monitoring too…