{"id":54420,"date":"2024-03-27T11:57:06","date_gmt":"2024-03-27T16:57:06","guid":{"rendered":"https:\/\/macreports.com\/?p=54420"},"modified":"2024-03-27T11:57:11","modified_gmt":"2024-03-27T16:57:11","slug":"how-to-install-gcc-on-your-mac","status":"publish","type":"post","link":"https:\/\/macreports.com\/how-to-install-gcc-on-your-mac\/","title":{"rendered":"How to Install GCC on Your Mac"},"content":{"rendered":"\n

GCC, GNU Compiler Collection<\/a>, is a collection of compilers and related tools for compiling and running programs written in various programming languages, including C, C++, Objective-C, Fortran, Go, D, Ada, and others. It is an open-source project. Your Mac does not come with GCC, but you can install it easily by following the steps below.<\/p>\n\n\n

\n
\"GCC<\/a><\/figure><\/div>\n\n\n

Requirements for installing GCC<\/h2>\n\n\n\n
    \n
  1. Command Line Tools for Xcode (The first step below involves installing this. If you already have it, you can skip this step.)<\/li>\n\n\n\n
  2. Homebrew (The second step below describes installing Homebrew. If you already have Homebrew installed, skip the second step.)<\/li>\n\n\n\n
  3. The most recent macOS version and an Internet connection, as GCC will be downloaded over the Internet<\/li>\n<\/ol>\n\n\n\n

    Install GCC<\/h2>\n\n\n\n

    I explain this in three steps. The first step is to install Command Line Tools, the second is to install Homebrew, and the third is to install GCC. <\/p>\n\n\n\n

      \n
    1. Open Terminal<\/strong> and enter the following command to install Command Line Tools:<\/li>\n<\/ol>\n\n\n\n
      xcode-select --install<\/code><\/pre>\n\n\n\n
        \n
      1. Now, let’s install Homebrew<\/a> by executing the following command:<\/li>\n<\/ol>\n\n\n\n
        \/bin\/bash -c \"$(curl -fsSL https:\/\/raw.githubusercontent.com\/Homebrew\/install\/HEAD\/install.sh)\"<\/code><\/pre>\n\n\n\n
          \n
        1. Now, it is time to install GCC. Type the following command and hit enter. Please note that several things will be downloaded and installed, so this can take some time:<\/li>\n<\/ol>\n\n\n\n
          brew install gcc<\/code><\/pre>\n\n\n\n
          \"brew<\/a><\/figure>\n\n\n\n

          Now that you have installed GCC, you will see the following screen:<\/p>\n\n\n

          \n
          \"GCC<\/a><\/figure><\/div>\n\n\n

          If you want to be sure that the installation was successful, enter the following command:<\/p>\n\n\n\n

          gcc --version<\/code><\/pre>\n\n\n
          \n
          \"GCC<\/a><\/figure><\/div>\n\n\n

          If you want to uninstall GCC later to free up storage, you can use the following code:<\/p>\n\n\n\n

          brew uninstall gcc<\/code><\/pre>\n\n\n
          \n
          \"Uninstall<\/a><\/figure><\/div>\n\n\n

          Related articles<\/strong><\/p>\n\n\n\n