LoginSignup
5
3

More than 5 years have passed since last update.

【Mac】gccのバージョン確認、新しいバージョン(8.2.0)をインストール

Posted at

Macにあらかじめインストールされているgccのバージョンは古いです。

$ gcc -dumpversion
4.2.1
$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Target: x86_64-apple-darwin18.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Homebrewで新しいバージョンをインストールできます。

$ brew install gcc

8系がインストールされました。コマンド名が変わっているので注意しましょう。

$ gcc-8 -dumpversion
8.2.0
$ gcc-8 --version
gcc-8 (Homebrew GCC 8.2.0) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3