I am using CentOS 7.9 and I encountered the same problem after following instructions here to install and run gcc 11. I tried launching different versions of gcc and found only devtoolset-9 works, which corresponds to the file devtoolset-9 in /etc/scl/conf/ folder. So I copied devtoolset-9 to devtoolset-11 in the same folder, and gcc 11 gets working.

Answer from zzzhhh on Stack Overflow
🌐
Stack Exchange
unix.stackexchange.com › questions › 718533 › when-i-use-sudo-command-it-returns-unable-to-open-etc-scl-prefixes-devtoolset
When I use sudo command, it returns "Unable to open /etc/scl/prefixes/devtoolset-9!" - Unix & Linux Stack Exchange
September 24, 2022 - I would surmise therefore that the sudo your first user is executing is actually in that that extra directory, and it is this that is trying to access /etc/scl/prefixes/devtoolset-9. (You can check this with type sudo and confirming that it is not in /usr/bin.)
Discussions

Scl enable devtoolset-7 bash on Rocky 9
I didn’t find scl or devtoolset-7 to install. How should I do? Thank you very much. More on forums.rockylinux.org
🌐 forums.rockylinux.org
16
0
March 9, 2023
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
Build fails on centos7 with devtoolset-7
The build of openssl 1.1.0 (and also 1.1.1) fails when devtoolset-7 is installed and enabled. Building 1.1.0 on a "vanilla" centos7 works. Installed devtoolset like this: $ yum install -y centos-re... More on github.com
🌐 github.com
8
April 1, 2019
install issue on RHEL7
Hi, I have the same issue. i tired both but no luck, any idea · also i'm unable to login from the webpage (not sure if it for the same reason), I'm getting this error More on github.com
🌐 github.com
13
August 31, 2017
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
🌐
GitHub
gist.github.com › sub-mod › a79ee1c45a2d6ebefe815770f77a5656
glibc ABI issue · GitHub
glibc ABI issue. GitHub Gist: instantly share code, notes, and snippets.
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 360004312319-enable-scl-devtoolset
enable scl devtoolset – IDEs Support (IntelliJ Platform) | JetBrains
1. I moved all my configuring code from .bashrc to .profile because (I don't remember exactly when) sometimes .bashrc was not applied to the environment. so for now devtoolset in .profile · 2. the command is "source scl_source enable devtoolset-4" .
🌐
Oracle
docs.oracle.com › en › operating-systems › oracle-linux › scl-user › scl-ReleaseNotes.html
Oracle Linux: Software Collection Library for Oracle Linux 7
January 2, 2025 - You should also exclude these packages from a yum update or yum install, by editing the /etc/yum.conf file and updating the exclude option. Or, you can use the --exclude flag when running the yum command. ... When installing the devtoolset-3-libasan-devel-4.9.1-10.el7 package, which requires the libasan-4.9.1-10.el7 package, there is a potential dependency issue if the libasan-static-4.8.3-9.el7 package is already present on the system.
Find elsewhere
🌐
GitHub
github.com › openssl › openssl › issues › 7982
Build fails on centos7 with devtoolset-7 · Issue #7982 · openssl/openssl
April 1, 2019 - The build of openssl 1.1.0 (and also 1.1.1) fails when devtoolset-7 is installed and enabled. Building 1.1.0 on a "vanilla" centos7 works. ... $ yum install -y centos-release-scl \ $ yum-config-manager --enable rhel-server-rhscl-7-rpms $ yum install -y devtoolset-7 $ source /opt/rh/devtoolset-7/enable
Author   openssl
🌐
Developer Community
developercommunity.visualstudio.com › t › linux-supportguide-for-redhat-devtoolset › 1617987
Linux Support/Guide for RedHat devtoolset
Skip to main content · Visual Studio · Guidelines Problems Suggestions Code of Conduct · Downloads · Visual Studio IDE Visual Studio Code Azure DevOps Team Foundation Server Accounts and Subscriptions · Subscriber Access · Microsoft Security Azure Dynamics 365 Microsoft 365 Microsoft ...
🌐
Red Hat
access.redhat.com › solutions › 3090181
Why `scl enable` command shows error "Unable to open /etc/scl/prefixes/gcc!" ? - Red Hat Customer Portal
July 21, 2017 - On installation of devtoolset-4-gcc-c++ the scl enable gcc bash gives the following error. # scl enable gcc bash Unable to open /etc/scl/prefixes/gcc!
🌐
Red Hat
access.redhat.com › discussions › 3279251
Red Hat Customer Portal - Access to 24x7 support and knowledge
January 4, 2018 - When executing scl command remote from other server cause error. Example ssh user1@server1.com scl enable rh-python36 'python /home/user1/setup.py install --user' cause error : Unable to open /etc/scl/conf/python!
🌐
GitHub
github.com › MISP › MISP › issues › 2430
install issue on RHEL7 · Issue #2430 · MISP/MISP
August 31, 2017 - /var/tmp/sclaPcqKl: line 8: /var/www/MISP/app/Console/worker/start.sh: Permission denied ! [root@XXXX ~]# su -s /bin/bash apache -c 'scl enable rh-php56 bash -c /var/www/MISP/app/Console/worker/start.sh' Unable to open /etc/scl/conf/bash!
Author   MISP
🌐
NVIDIA
docs.nvidia.com › doca › archive › doca-v1.5.1 › troubleshooting › index.html
Troubleshooting Guide - NVIDIA Docs
Upgrading the devtoolset on the machine to the one used when building the gRPC package resolves the version conflict: ... $ sudo yum install epel-release $ sudo yum install centos-release-scl-rh $ sudo yum install devtoolset-8 $ sudo scl enable devtoolset-8 # This will enable the use of devtoolset-8 to the *current* bash session $ source /opt/rh/devtoolset-8/enable
🌐
Austindewey
austindewey.com › 2019 › 03 › 26 › enabling-software-collections-binaries-on-a-docker-image
Enabling Software Collections Binaries On A Docker Image<!-- --> - Austin Dewey
With the given Dockerfile, you could, however, run docker run –name scl-test -it scl-test to start an interactive /bin/sh session (leveraging ENV), and your scl binaries would be enabled there. Hopefully this helps resolve some confusion around Software Collections and persistently enabling scl binaries in a Dockerfile.
🌐
Red Hat
docs.redhat.com › en-us › documentation › red_hat_developer_toolset › 9 › pdf › user_guide › Red_Hat_Developer_Toolset-9-User_Guide-en-US.pdf pdf
Red Hat Developer Toolset 9 User Guide
October 2, 2025 - 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-9 'tool option ...
Top answer
1 of 3
3

You should try using -- instead of surrounding your command with quotes.

scl enable python27 -- ls /tmp

I was able to make a python script that uses the rh-python35 collection with this shebang:

#!/usr/bin/scl enable rh-python35 -- python

import sys
print(sys.version)
2 of 3
1

The parsing of arguments in the she-bang command is not really defined. From man execve:

The semantics of the optional-arg argument of an interpreter script vary across implementations. On Linux, the entire string following the interpreter name is passed as a single argument to the interpreter, and this string can include white space. However, behavior differs on some other systems. Some systems use the first white space to terminate optional-arg. On some systems, an interpreter script can have multiple arguments, and white spaces in optional-arg are used to delimit the arguments.

No matter what, argument splitting based on quote sis not supported. So when you write:

#!/usr/bin/scl enable python27 "ls /tmp"

It's very possible that what gets invoked is (using bash notation):

'/usr/bin/scl' 'enable' 'python27' '"ls' '/tmp"'

This is probably why it tries to open the "ls file at /etc/scl/prefixes/"ls

But it is just as likely that the shebang evaluates to:

'/usr/bin/scl' 'enable python27 "ls /tmp"'

And that would fail since it wont be able to find a command named enable python27 "ls /tmp" for scl to execute.

There's a few workarounds you can use.

You can call your script via scl:

$ cat myscript
#!/bin/bash
echo hello

$ scl enable python27 ./myscript
hello

You can also use the heredoc notation, but it might lead to subtle issues. I personally avoid this:

$ cat ./myscript
#!/bin/bash
scl enable python27 -- <<EOF
echo hi
echo \$X_SCLS
EOF

$ bash -x myscript 
+ scl enable python27 --
hi
python27

You can see one of the gotcha's already: I had to write \$X_SCLS to access the environment variable instead of just $X_SCL.

Edit: Another option is two have two scripts. One that has the actual code, and the second that simply does scl enable python27 $FIRST_SCRIPT. Then you wont have to remember to enter scl ... manually.

🌐
Processmaker
wiki.processmaker.net › 3.3 › Database_Connections › MSSQL
3.2 - 3.7 - Database Connections - Microsoft SQL Server | Documentation@ProcessMaker
sudo yum-config-manager --enable rhel-server-rhscl-7-rpms sudo yum install centos-release-scl sudo yum install devtoolset-7-gcc-c++ scl enable devtoolset-7 bash