The scl enable ... command creates a new shell; you've probably ended up with several nested layers of shells if you've been testing this. If you exit, you'll probably see the gcc --version output from the base system. See how deeply-nested you are with something like pstree -s $$.

To run gcc --version with scl, just put the command on the scl line:

 scl enable devtoolset-9 'gcc --version'

Reference: The Red Hat Developer Toolset 9 User Guide (pdf).

Answer from Jeff Schaller on Stack Exchange
🌐
Red Hat
docs.redhat.com › en › documentation › Red_Hat_Developer_Toolset › 9 › html-single › user_guide › index
User Guide | Red Hat Developer Toolset | 9 | Red Hat Documentation
Red Hat Developer Toolset is distributed with GCC 9.3.1. This version is more recent than the version included in Red Hat Enterprise Linux and provides a number of bug fixes and enhancements. In Red Hat Developer Toolset, the GNU C compiler is provided by the devtoolset-9-gcc package and is ...
🌐
Hacker News
news.ycombinator.com › item
For the record, CentOS 7 can have gcc-9 by installing devtoolset-9. To get acces... | Hacker News
August 17, 2020 - But people delivering libraries to customers who have elected not to upgrade to current releases are pretty much stuck. It is extremely common for banks, in particular, to still be running gcc-4, and to have no plans ever to upgrade · It is common at least in banks to have an unbreakable policy ...
🌐
Cloudlinux
repo.cloudlinux.com › cloudlinux › 7 › sclo › devtoolset-9 › x86_64
Index of /cloudlinux/7/sclo/devtoolset-9/x86_64/
../ repodata/ 07-Nov-2025 14:13 - devtoolset-9-9.1-0.el7.x86_64.rpm 07-Nov-2025 14:13 5172 devtoolset-9-annobin-8.79-2.el7.x86_64.rpm 07-Nov-2025 14:13 107136 devtoolset-9-annobin-annocheck-8.79-2.el7.x86_6..> 07-Nov-2025 14:13 104740 devtoolset-9-binutils-2.32-16.el7.x86_64.rpm 07-Nov-2025 14:13 6221600 devtoolset-9-binutils-devel-2.32-16.el7.x86_64.rpm 07-Nov-2025 14:13 918924 devtoolset-9-build-9.1-0.el7.x86_64.rpm 07-Nov-2025 14:13 3256 devtoolset-9-dwz-0.12-1.1.el7.x86_64.rpm 07-Nov-2025 14:13 99772 devtoolset-9-dyninst-10.1.0-4.el7.x86_64.rpm 07-Nov-2025 14:13 3937800 devtoolset-9-dynins
🌐
Tenable
tenable.com › plugins › nessus › 170330
RHEL 7 : devtoolset-9-gcc (RHSA-2020:2274)<!-- --> | Tenable®
January 23, 2023 - The remote Redhat Enterprise Linux ... languages, including C, C++, and Fortran. The devtoolset-9-gcc packages provide the Red Hat Developer Toolset version of GCC, as well as related libraries....
🌐
GitHub
github.com › sclorg › sclo-ci-tests › blob › master › PackageLists › devtoolset-9 › all
sclo-ci-tests/PackageLists/devtoolset-9/all at master · sclorg/sclo-ci-tests
Scripts for testing SCLo builds from cbs.centos.org - sclo-ci-tests/PackageLists/devtoolset-9/all at master · sclorg/sclo-ci-tests
Author   sclorg
Find elsewhere
🌐
Red Hat
docs.redhat.com › en › documentation › red_hat_developer_toolset › 9 › epub › 9.0_release_notes › index
9.0 Release Notes | Red Hat Developer Toolset | 9 | Red Hat Documentation
All components in Red Hat Developer Toolset 9.0 are distributed as new packages with the devtoolset-9- prefix and only for Red Hat Enterprise Linux 7.
🌐
JLab Wiki
wiki.jlab.org › epsciwiki › index.php › Using_devtoolset-9_on_your_RHEL7_desktop › laptop
Using devtoolset-9 on your RHEL7 desktop/laptop - epsciwiki
sudo yum install devtoolset-9 · To use the tools from a given toolset, you need to launch a new shell with those enabled via: scl enable devtoolset-9 tcsh · You will need to do this for every shell you use with the toolset.
🌐
RPMfind
rpmfind.net › linux › rpm2html › search.php
RPM resource gcc-toolset-9-gcc
The gcc-toolset-9-gcc package contains the GNU Compiler Collection version 9.
🌐
Discourse
fortran-lang.discourse.group › t › compiling-newer-gcc-with-old-os › 3608
Compiling newer GCC with old OS - Fortran Discourse
May 30, 2022 - Hello, Just a quick question: I have been trying to manage some old clusters with CentOS-6, which only has GCC-4.8 (an extremely old version!). Because I would like to use newer GCC, I first tried Homebrew (Linuxbrew), …
🌐
Red Hat
developers.redhat.com › articles › 2023 › 11 › 10 › install-gcc-and-build-hello-world-application-rhel-9
Install GCC and build a Hello World application on RHEL 9 | Red Hat Developer
November 10, 2023 - The GCC Toolset in Red Hat Enterprise Linux 9 remains supported, allowing developers to access cutting-edge development and performance analysis tools. This toolset is similar to the Red Hat Developer Toolset for RHEL 7 and is conveniently available ...
🌐
Red Hat
access.redhat.com › solutions › 7109025
Is devtoolset package available for Red Hat Enterprise Linux 9? - Red Hat Customer Portal
March 31, 2025 - Where is Developer Toolset for Red Hat Enterprise Linux 9? RHEL 9 does not have devtoolset packages available
🌐
Red Hat
access.redhat.com › solutions › 19458
What GCC versions are available in Red Hat Enterprise Linux? - Red Hat Customer Portal
What GCC versions are available in Red Hat Enterprise Linux? What C and C++ compiler comes with RHEL, GCC Toolset, Developer Toolset? Are the GCC Toolset and Developer Toolset available for my RHEL version?