When I type gcc -v
, I get :
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin14.0.0/4.9.2/lto-wrapper
Target: x86_64-apple-darwin14.0.0
Configured with: ../gcc-4.9-20141029/configure --enable-languages=c++,fortran
Thread model: posix
gcc version 4.9.2 20141029 (prerelease) (GCC)
So my gcc version is 4.9.2 However, when I try to install gcc again by typing : brew tap homebrew/versions; brew install gcc --without-multilib
brew tap homebrew/versions; brew install gcc --without-multilib
I get :
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 3 taps (homebrew/core, homebrew/science, homebrew/versions).
==> New Formulae
git-quick-stats homebrew/science/med-file ktmpl
==> Updated Formulae
aha homebrew/science/bowtie mpd
akka homebrew/science/cdo mysql-cluster
arangodb homebrew/science/matplotlib no-more-secrets
buku homebrew/science/packmol nvm
bullet homebrew/science/paraview protobuf-swift
casperjs homebrew/science/pymol qca
certigo imagemagick ✔ ringojs
chicken imagemagick@6 rust
cjdns jenkins skinny
coffeescript jigdo sqldiff
compcert jump sqlite-analyzer
crystal-lang kobalt svtplay-dl
dbhash libhdhomerun swiftgen
digdag libphonenumber vim
direnv libsigsegv wakatime-cli
elixirscript mapserver wolfssl
embulk mecab-jumandic yank
geoserver mkvtoolnix yaz
gitlab-ci-multi-runner mosquitto
==> Deleted Formulae
bip homebrew/versions/openssl101 probatron4j
edelta lcab rtpbreak
esound malaga
Updating Homebrew...
Warning: gcc-6.3.0_1 already installed
This output says at the end that I have gcc 6.3 . Am I working with gcc 4.9.2 or gcc 6.3 ?
PS : If you are interested in why I executed the brew tap & brew install commands, it is because I am trying to install xgboost in python. In the github repo of xgboost , they're advising to run the above commands before installation to get the latest g++ compiler.
To address your question "Am I working with gcc 4.9.2 or gcc 6.3"
You are still working with gcc 4.9.2.
How can you make gcc-6 your default compiler? See below:
sudo ln -s <path-to>/gcc-6 <path-to>/gcc
Now exit the terminal session and open a new terminal (so the links update) and type gcc -v
and see if the version is now the latest.
NOTICE: You may also wish to update c++ -> c++-6
, g++ -> g++-6
, and cpp -> cpp-6
in a similar fashion, just repeat the above step for each in turn, ALWAYS BACKUP in case something goes wrong so you can undo everything if necessary.
If you get a "Operation not permitted" warning and you are using El Capitan or newer version of Mac OS X please see this question/answer on how to disable the security feature that is preventing you from making changes to /usr/bin directory:
https://superuser.com/questions/933019/sudo-cant-create-file-in-usr-bin-in-el-capitan
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.