I feel foolish because I figured it out right after posting, but I figured I'd share because it isn't intuitive and hopefully this will save someone some time.

The package you want to install is not gcc. You want to install gcc-toolset-9. You will notice after installation that you will still get 8.x if you do a gcc --version. gcc-toolset-9 installs to /opt. The idea is to give you a separate development environment. See this documentation. After installation you can run the updated gcc with /opt/rh/gcc-toolset-9/<username>/bin/gcc.

As @Stephen Kitt pointed out, you can actually get a shell with the updated toolset by running scl enable gcc-toolset-9 bash. Running this command will open a new bash session with the environment variables appropriately updated.

You can also run gcc v.9 directly with scl enable gcc-toolset-9 gcc <your_gcc_args>. See this documentation for details.

Answer from Grant Curell on Stack Exchange
🌐
Red Hat
developers.redhat.com › articles › 2025 › 04 › 16 › gcc-and-gcc-toolset-versions-rhel-explainer
GCC and gcc-toolset versions in RHEL: An explainer | Red Hat Developer
April 16, 2025 - For example, gcc-toolset-12 is available in RHEL 9, but its support ended in November 2024 (after two years) as part of the Application Streams life cycle. ... For long-term stability and support: Use the built-in system GCC (8.x in RHEL 8) if you need a compiler that's supported for the entire RHEL life cycle.
🌐
Red Hat
docs.redhat.com › en › documentation › red_hat_enterprise_linux › 8 › html › developing_c_and_cpp_applications_in_rhel_8 › additional-toolsets-for-development_developing-applications
Chapter 4. Additional toolsets for development | Developing C and C++ applications in RHEL 8 | Red Hat Enterprise Linux | 8 | Red Hat Documentation
Using the C++11 language version is supported when all C++ objects compiled with the appropriate flag have been built using GCC version 5 or later. ... This language standard is available in the GCC Toolset 9. Binaries, shared libraries and objects built using this standard can be freely mixed regardless of being built with GCC from the GCC Toolset, Red Hat Developer Toolset, and RHEL 5, 6, 7 and 8...
Discussions

rhel - How to install gcc 9.X on RHEL8? - Unix & Linux Stack Exchange
I see from the documentation here that gcc has been updated on RHEL8, but what I haven't figured out is how to get it. The documentation indicates that there are now two streams, but I already hav... More on unix.stackexchange.com
🌐 unix.stackexchange.com
May 7, 2020
rhel8 - How to Install devtoolset 8 in RHEL 8 image - Stack Overflow
Please help me to install dev toolset-8 in rhel 8 image. i have pulled the base image as below . I want to install devtoolset-8. is there any other way please let me know. sudo docker pull registry. More on stackoverflow.com
🌐 stackoverflow.com
linux - "scl load gcc-toolset-11" run failed - Stack Overflow
I want to install gcc-11 in Rocky Linux 8.6. At first, I install gcc-toolset-11, $ sudo dnf install gcc-toolset-11 Then I want to load it to the current bash. $ scl load gcc-toolset-11 ERROR: Unab... More on stackoverflow.com
🌐 stackoverflow.com
linux - On el8/el9/newer, how do you get newer versions of software like python3, gcc, java, etc? - Stack Overflow
For example on el7: to develop an nvidia CUDA application you need a newer gcc than the default gcc version 4.8.x and to get the newer version you would use a software repo called "Software More on stackoverflow.com
🌐 stackoverflow.com
🌐
SciVision
scivision.dev › install-modern-compilers-redhat
Use modern compilers in RHEL | Scientific Computing
July 2, 2023 - GCC Toolset enables modern compiler selection for RHEL users.
🌐
OneUptime
oneuptime.com › home › blog › how to install gcc and development tools on rhel
How to Install GCC and Development Tools on RHEL
March 4, 2026 - # List available GCC toolsets sudo dnf search gcc-toolset # Install GCC Toolset 13 (includes GCC 13) sudo dnf install -y gcc-toolset-13 # Enable the toolset for your session scl enable gcc-toolset-13 bash # Verify the newer GCC version gcc --version ...
Find elsewhere
🌐
Tenable
tenable.com › plugins › nessus › 155158
RHEL 8 : gcc-toolset-11-annobin (RHSA-2021:4591)<!-- --> | Tenable®
CPE: p-cpe:/a:redhat:enterprise_linux:gcc-toolset-11-annobin-annocheck, p-cpe:/a:redhat:enterprise_linux:gcc-toolset-11-annobin, p-cpe:/a:redhat:enterprise_linux:gcc-toolset-11-annobin-docs, cpe:/o:redhat:enterprise_linux:8, p-cpe:/a:redhat:enterprise_linux:gcc-toolset-11-annobin-plugin-gcc · Required KB Items: Host/local_checks_enabled, Host/RedHat/release, Host/RedHat/rpm-list, Host/cpu
🌐
Red Hat
docs.redhat.com › en › documentation › red_hat_developer_toolset › 11 › html-single › user_guide › index
User Guide | Red Hat Developer Toolset | 11 | Red Hat Documentation
Toolset”. To compile a C program with debugging information that can be read by the GNU Debugger, make sure the gcc compiler is run with the -g option: scl enable devtoolset-11 'gcc -g -o output_file input_file...' $ scl enable devtoolset-11 'gcc -g -o output_file input_file...'
Top answer
1 of 1
1

in a nutshell, here are some examples for how to install and configure

  • for python3 to get python3.9: dnf install -y python39 && alternatives --set python3 $(command -v python3.9)
  • for gcc to get gcc-12: dnf install gcc-toolset-12 && source scl_source enable gcc-toolset-12
  • for java to get java-17: dnf install java-17 && bin_java_filename=$(rpm -qa|grep java-17|xargs rpm -ql|grep "bin\/java$"|head -1) && alternatives --set java ${bin_java_filename}
  • tested on rocky8, rocky9

which repo has the newer software versions?

  • the old method using "SCL" was deprecated
  • the new method is to use a repo called "appstream"
  • here is a post written by the distro maintainers explaining the change https://developers.redhat.com/blog/2018/11/15/rhel8-introducing-appstreams
  • the repo is enabled by default

how to: install newer software versions?

  • for python3: dnf install python39
  • for gcc: dnf install gcc-toolset-12

how to: change the system default?

  • for python3: alternatives --set python3 $(command -v python3.9)
  • for gcc:
    • edit your user .bashrc or .bash_profile or create a new file under /etc/profile.d/ with the following: source scl_source enable gcc-toolset-12
    • i thought scl_source would go away in el8, el9 but apparently not
    • for more info on scl_source go to this link https://unix.stackexchange.com/a/195219/5510 or Permanently enable RHEL scl

p.s. what is the difference between alternatives and update-alternatives?

  • the original tool is called update-alternatives and is from Debian linux distro
  • in EnterpriseLinux, Redhat rewrote the tool and called it alternatives and when you install alternatives the package also installs a symlink with name update-alternatives on your env var PATH to help you find the tool
  • the two are similar but not the same because their source code is different
🌐
Utk
help.eecs.utk.edu › knowledge-base › linux-topics › using-redhat-software-collections
Using Red Hat Software Collections [EECS IT Help]
To check which specific software collections are available on a computer, scl list-collections (RHEL 8/9) command: user:hydra0 ~> scl list-collections gcc-toolset-11 gcc-toolset-12 gcc-toolset-13 gcc-toolset-14 gcc-toolset-9
🌐
Red Hat
access.redhat.com › solutions › 19458
What GCC versions are available in Red Hat Enterprise Linux? - Red Hat Customer Portal
July 21, 2025 - Developer Toolset (DTS) GNU Compiler Collection (GCC) 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?
🌐
Tenable
tenable.com › plugins › nessus › 155164
RHEL 8 : gcc-toolset-11-gcc (RHSA-2021:4586)<!-- --> | Tenable®
November 11, 2021 - The remote Red Hat host is missing a security update for gcc-toolset-11-gcc. The remote Redhat Enterprise Linux 8 host has packages installed that are affected by a vulnerability as referenced in the RHSA-2021:4586 advisory. - Developer environment: Unicode's bidirectional (BiDi) override characters can cause trojan source attacks (CVE-2021-42574) Note that Nessus has not tested for this issue but has instead relied only on the application's self-reported version number. Update the RHEL gcc-toolset-11-gcc package based on the guidance in RHSA-2021:4586.
🌐
LinuxConfig
linuxconfig.org › home › how to install gcc the c compiler on rhel 8 / centos 8
How to install GCC the C compiler on RHEL 8 / CentOS 8
September 24, 2019 - Learn to install the GCC compiler on RHEL 8/CentOS 8 and compile a C program. Step-by-step guidance for developers.
🌐
Red Hat
access.redhat.com › documentation › en-us › red_hat_developer_toolset › 12 › html-single › user_guide › index
User Guide | Red Hat Developer Toolset | 12 | Red Hat Documentation
May 9, 2023 - All compilers from Red Hat Enterprise Linux versions 5, 6, and 7 and from Red Hat Developer Toolset versions 1 to 10 in any -std mode are compatible with any other of those compilers in C++98 mode. A compiler in C++11, C++14, or C++17 mode is only guaranteed to be compatible with another compiler in those same modes if they are from the same release series. ... The GCC compiler in Red Hat Developer Toolset 10.x can build code using C++20 but this capability is experimental and not supported by Red Hat.
🌐
Rocky Linux Forum
forums.rockylinux.org › rocky linux help & support
How to install gcc-toolset-11 on rocky 9.4? - Rocky Linux Help & Support - Rocky Linux Forum
October 1, 2024 - I need to install it for autodesk maya2025 devkit, which requires RHEL or Rocky Linux 8.6 or higher, using DTS-11 with gcc 11.2.1 But not sure how to install it, dnf search only shows gcc-toolset 12 13 14 What is the …