Glenmore Marshall offers the following instructions for installing C++ on your Macintosh.
Check first if you have C++ in
Terminal.app
.
gcc
is
c++
through
Homebrew
and it works as in class using the
g++
command in
Terminal.app
.
gcc --version
clang
is the version of C++ used by Mac with
Xcode.
It is usually installed on newer Mac computers
and can be updated using brew or installing
Xcode
using the
Mac app store.
Use the
clang
command in
Terminal.app
as you would
c++
/g++
in class
clang --version
If you do not already have c++ installed,
install
Homebrew
using the command below in
Terminal.app
.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
You can also use this link and use the
.pkg
installer if you are familiar with GitHub:
https://github.com/Homebrew/brew/releases/tag/4.4.20
To use brew to install c++, choose one of the following. You do not need to install both.
brew install gcc
brew install llvm
To see what version of a package you are using,
and if it is installed:
"package name" --version
For example,
gcc --versionor
g++ --version
clang --version
To update a specific package:
brew upgrade "package name"
For example, to update C++,
brew upgrade gcc