How to install gcc

less than 1 minute read

Linux

Debian-based (Debian, Ubuntu, Mint, etc…)

sudo apt-get install gcc

RPM-based (Red Hat Linux, CentOS, Fedora, openSuse, Mandrake Linux)

sudo yum install gcc

Windows

  1. Download MinGW from https://sourceforge.net/projects/mingw-w64/.

  2. Run the executable file and follows the steps.

  3. The installation process will prompt the “MinGW Installation Manager”, with a list of packages. Tick mingw32-gcc-g++-bin and mingw32-gcc-gfortran-bin (if you need Fortran also). If you are prompted with a menu, click on Mark for Install. Then on the top left corner click on Installation > Apply Changes.

  4. After the installation finishes, edit the Enviromental Variables. Search for “Environment Variables” in Windows Search. At the bottom “System Variables” panel, add to the “Path” variable: C:\MinGW\bin or the full address of that folder if you have used a different one during the installation. Click on OK, and OK and close the other windows.

  5. Open a Command Prompt Terminal and try typing gcc –version and press <Enter> to check if it works.

macOS

  1. If you don’t have Xcode installed, install it.

  2. Install Command Line Tools for Xcode. Open a terminal window and type:
     xcode-select --install
    
  3. Install gcc using Homebrew:
     brew update
     brew upgrade
     brew info gcc
     brew install gcc
     brew cleanup
    

Categories:

Updated:

Leave a comment