Clang環境からGCC環境MacM
Last login: Mon Jun 10 14:36:06 on ttys000
% brew list | grep gcc
~
❯ % brew list | grep gcc 15:02
fg: no job control in this shell.
~
❯ % brew list | grep gcc 15:02
fg: no job control in this shell.
~
❯ brew list | grep gcc 15:02
gcc
~
❯ % ls /usr/local/Cellar | grep gcc 15:03
fg: no job control in this shell.
~
❯ ls /usr/local/Cellar | grep gcc 15:03
ls: /usr/local/Cellar: No such file or directory
~
❯ gcc --version 15:03
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
~
❯ 15:03
~
❯ g++ --version 15:03
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
~
❯ ls /usr/local/bin | grep gcc 15:03
~
❯ cd /opt/homebrew/bin 15:03
/opt/homebrew/bin
❯ ls /opt/homebrew/bin | grep gcc 15:04
aarch64-apple-darwin23-gcc-14
aarch64-apple-darwin23-gcc-ar-14
aarch64-apple-darwin23-gcc-nm-14
aarch64-apple-darwin23-gcc-ranlib-14
gcc
gcc-14
gcc-ar-14
gcc-nm-14
gcc-ranlib-14
/opt/homebrew/bin
❯ ln -s /opt/homebrew/bin/gcc-14 /usr/local/bin/gcc 15:04
ln: /usr/local/bin/gcc: Permission denied
/opt/homebrew/bin
❯ sudo ln -s /opt/homebrew/bin/gcc-14 /usr/local/bin/gcc 15:05
Password:
/opt/homebrew/bin
❯ sudo ln -s /opt/homebrew/bin/g++-14 /usr/local/bin/g++ 15:05
/opt/homebrew/bin
❯ which gcc 15:06
/usr/local/bin/gcc
/opt/homebrew/bin
❯ gcc --version 15:06
gcc (Homebrew GCC 14.1.0_1) 14.1.0
Copyright (C) 2024 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.
/opt/homebrew/bin
❯ g++ --version 15:06
g++ (Homebrew GCC 14.1.0_1) 14.1.0
Copyright (C) 2024 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.
/opt/homebrew/bin
❯ which gcc 15:07
/usr/local/bin/gcc
/opt/homebrew/bin
❯
なんか出来たからヨシっ
考察解説
Homebrewのgcc(/opt/homebrew/bin)とAppleのclang(/usr/bin)がある
Appleのclangが優先されてHomebrewのgccがうんともすんとも言わない
シンボルックリンクを使ってgcc優先する
← Go home