I had this problem as well. I don't know why scl was failing to enable the environment, but I was able to get it to load with source /opt/rh/devtoolset-7/enable.

Answer from user561726 on serverfault.com
🌐
Calvin
borg.calvin.edu › resources-softwarecollections.html
Resources - Software Collections - Borg
April 18, 2024 - echo "source scl_source enable devtoolset-7" >> ~/.bashrc
Discussions

0.18.1 doesn't build on CentOS 7 with devtoolset-7
FROM centos:7 WORKDIR /root/ RUN ... ENV EDITOR=vim ENV VISUAL=vim # centos-release-scl need to be installed before devtoolset-7-gcc* # Each RUN command will need `source scl_source enable devtoolset-7` to load GCC 7 RUN yum install -y devtoolset-7-gcc* && \ echo "source ... More on github.com
🌐 github.com
2
September 20, 2019
centos - How to make devtoolset g++ available for Makefile in docker's centos7? - Unix & Linux Stack Exchange
So how should i do to make g++-7 activated in my Makefile, instead of the default g++ of CentOS? ... Does this work? RUN source scl_source enable devtoolset-7 && cd /home/admin/${APP_NAME}/nginx-base/cplusplus && make version && make More on unix.stackexchange.com
🌐 unix.stackexchange.com
July 19, 2019
linux - How to permanently enable newer version of software installed from SCL repo? - Unix & Linux Stack Exchange
So when you put it in your .bashrc, it creates a new shell...which loads your .bashrc, which runs scl enable devtoolset-1.1 bash, which creates a new shell, which loads your .bashrc... Forkbomb! You probably want something like this in your .bashrc: if [ "$(gcc -dumpversion)" != "4.7.2" ]; then ... More on unix.stackexchange.com
🌐 unix.stackexchange.com
May 8, 2020
Gcc 7.3.1 not available when generating a C++17 Singularity ROOT image
ROOT Version: 6.14.08 _Platform: CentOS 7 Compiler: g++ Dear experts, I have run into a problem when trying to build root on CentOS 7. I have installed devtoolset-7-gcc* and enabled it via scl enable devtoolset-7 bash. Furthermore I have chosen the option -Dcxx17 for cmake and turned off the ... More on root-forum.cern.ch
🌐 root-forum.cern.ch
1
0
January 18, 2019
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 360004312319-enable-scl-devtoolset
enable scl devtoolset – IDEs Support (IntelliJ Platform) | JetBrains
So all you have to do is tell CLion to point towards what devtoolset is providing. When you do scl enable devtoolset, it is simply pointing towards what devtoolset provides.
🌐
GitHub
github.com › qtumproject › qtum › issues › 771
0.18.1 doesn't build on CentOS 7 with devtoolset-7 · Issue #771 · qtumproject/qtum
September 20, 2019 - ENV EDITOR=vim ENV VISUAL=vim # centos-release-scl need to be installed before devtoolset-7-gcc* # Each RUN command will need `source scl_source enable devtoolset-7` to load GCC 7 RUN yum install -y devtoolset-7-gcc* && \ echo "source ...
Author   qtumproject
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 [ 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 [ {#_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
🌐
CERN
root-forum.cern.ch › t › gcc-7-3-1-not-available-when-generating-a-c-17-singularity-root-image › 32356
Gcc 7.3.1 not available when generating a C++17 Singularity ROOT image - ROOT - ROOT Forum
January 18, 2019 - ROOT Version: 6.14.08 _Platform: CentOS 7 Compiler: g++ Dear experts, I have run into a problem when trying to build root on CentOS 7. I have installed devtoolset-7-gcc* and enabled it via scl enable devtoolset-7 bash.
Find elsewhere
🌐
Chapel-lang
chapel-lang.org › docs › 2.1 › usingchapel › prereqs.html
Chapel Prerequisites — Chapel Documentation 2.1
CentOS 7 Devtoolset 11 (but note CentOS 7 CHPL_LLVM=system incompatibility): sudo yum install centos-release-scl sudo yum install devtoolset-11-gcc* sudo yum install epel-release sudo scl enable devtoolset-11 bash sudo echo source scl_source enable devtoolset-11 >> ~/.bashrc sudo yum install ...
🌐
Softwarecollections
softwarecollections.org › en › scls › rhscl › devtoolset-8
Developer Toolset 8 — Software Collections
# 1. Install a package with repository for your system: # On CentOS, install package centos-release-scl available in CentOS repository: $ sudo yum install centos-release-scl # On RHEL, enable RHSCL repository for you system: $ sudo yum-config-manager --enable rhel-server-rhscl-7-rpms # 2. Install the collection: $ sudo yum install devtoolset-8 # 3.
🌐
GitHub
github.com › sclorg › devtoolset-container › blob › master › 7-toolchain › Dockerfile
devtoolset-container/7-toolchain/Dockerfile at master · sclorg/devtoolset-container
PATH=/opt/app-root/src/bin:/opt/app-root/bin:/opt/rh/devtoolset-7/root/usr/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin · · RUN mkdir -p ${HOME} && \ groupadd -r default -f -g 1001 && \ usermod -g default default && \ chown -R 1001:1001 /opt/app-root /usr/bin/container-entrypoint /usr/bin/usage && \ chmod u+x /usr/bin/usage && \ rpm-file-permissions · · USER 1001 · · WORKDIR ${HOME} · # Enable the SCL for all bash scripts.
Author   sclorg
🌐
University of Edinburgh
computing.help.inf.ed.ac.uk › scl
Software Collections | Documentation
To activate the devtoolset you ... You can run any application or script you wish, it does not need to be a shell. The scl enable command is used to enable the specified software collection....
🌐
Posit Support
support.posit.co › hc › en-us › articles › 360006145413-RStudio-Workbench-RStudio-Server-Pro-with-devtoolset-enabled
Posit Workbench with devtoolset enabled – Posit Support
July 25, 2024 - For example, on CentOS 7: yum install centos-release-scl · yum install devtoolset-9 · Execute: gcc --version · Enable devtoolset-10 with: source scl_source enable devtoolset-9 · Review gcc version now with: gcc --version · Once tested, ...
Top answer
1 of 1
1

This issue in this case is RedHat subscription channels. Though the subscription and software are free (provided you have an active subscription already), for some reason you have to make a 'special request' to RedHat as per:

https://access.redhat.com/solutions/472793

You can automate this by visiting:

https://www.redhat.com/wapps/try/RHSCL

(when logged into the support portal). This should automatically be approved after which you can attach a new subscription. Identify the pool id using:

subscription-manager list --available --all

To find the pool id:

 Subscription Name:   Software Collections and Developer Toolset
 Provides:            Red Hat Developer Tools (for RHEL Server)
                      Red Hat Developer Tools Beta (for RHEL Workstation)
                      Red Hat Software Collections Beta (for RHEL Server)
                      Red Hat Software Collections Beta (for RHEL Workstation)
                      Red Hat Software Collections (for RHEL Server)
                      Red Hat Developer Tools Beta (for RHEL Server)
                      Red Hat Developer Toolset (for RHEL Workstation)
                      Red Hat Software Collections Beta (for RHEL Client)
                      Red Hat Software Collections (for RHEL Workstation)
                      Red Hat Developer Toolset (for RHEL Server)
                      Red Hat Developer Tools (for RHEL Workstation)
                      Red Hat Software Collections (for RHEL Client) 
SKU:                 foobar 
Contract:            1234 Pool ID: XXXXXXXXXX

Then attach this and enable the newly available repos:

>subscription-manager attach --pool=XXXXXXXXXXXXXXXXXXXX
Successfully attached a subscription for: Software Collections and Developer Toolset
>subscription-manager repos --enable rhel-workstation-rhscl-7-rpms
Repository 'rhel-workstation-rhscl-7-rpms' is enabled for this system.
>subscription-manager repos --enable rhel-7-workstation-devtools-rpms
Repository 'rhel-7-workstation-devtools-rpms' is enabled for this system.

You can now install freely:

>yum update -y 
>yum install -y devtoolset-7-gcc-c++

Quite why they make you jump through so many hoops is explained by RedHat as follows:

-If you have a 2013 RHEL SKU with Standard or Premium service level, there should be no action on your part, and your subscription should have full access to RHSCL.

-If you have a 2010 or older RHEL SKU with Standard or Premium service level, you should contact Red Hat Customer Service to request the RHSCL SKU (and all related content) added to your account.

NOTE: Developer Toolset is now included as part of Red Hat Software Collections. This change was made on May 29, 2014.

As you had Red Hat Enterprise Linux Workstation, Standard subscription which is older RHEL SKU with Standard service level, you had to initiate a special request for it

🌐
CopyProgramming
copyprogramming.com › howto › source-scl-source-enable-devtoolset-6-code-example
Mastering SCL Source Enable Devtoolset-6: Code Examples, Latest Updates, Features, and Best Practices in 2026
November 11, 2025 - What's the difference between scl enable and source scl_source enable? scl enable spawns a child shell; source scl_source enable modifies current shell directly. Use the latter for non-interactive scripts and persistent setups. Both point to /opt/rh/devtoolset-6/enable.