Skip to content

Latest commit

 

History

History
176 lines (129 loc) · 5.17 KB

macos.md

File metadata and controls

176 lines (129 loc) · 5.17 KB

macOS

This guide documents the steps to perform in order to install, on macOS-based laptops and desktops, all the software needed to fruitfully attend the hands-on session of this C++ Basic Workshop.

Xcode Command Line Tools

The Xcode Command Line Tools (CLT) are required in order to successfully install the Homebrew package manager. Moreover they ensure that a second compiler is available as a fallback solution in case of problem with the preferred one (GCC).

To install the CLT, open a Terminal and issue:

% xcode-select --install

A pop-up window will open, asking to confirm the installation.

Proceed by following the instructions (which will likely include the request to type your account's password or authenticate using the fingerprint reader).

Depending on the network performance, the installation may take some time (e.g. up to half an hour or more). Once completed, you can verify that the procedure was successful by issuing the following command, and checking that its output is consistent with:

% xcode-select -p
/Library/Developer/CommandLineTools

Alternatively, if you have already installed the full Xcode suite, the following output is equivalently valid:

% xcode-select -p
/Applications/Xcode.app/Contents/Developer

Homebrew

The Homebrew package manager (hereafter referred to as brew) is the main tool we will use to install and keep up-to-date all the programs and libraries used during the workshop.

To proceed with the installation, the minimal requirements are:

  • A 64-bit Intel CPU or Apple Silicon CPU 1
  • macOS Monterey (12) (or higher)
  • the Command Line Tools (CLT) for Xcode (or Xcode)
  • the Bourne-again shell (available by default on macOS)

If all of them are satisfied, open a Terminal and issue the following command:

% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

If, during the installation, errors appear complaining about missing certificates when the curl command is ran, try to open the offending URL within the Safari browser, and entrust all certificates. Then, issue the installation command again.

Please note that, to complete the installation, instructions may appear at the bottom of the terminal where the installation command was ran. If needed, please take care of following them as well.

To verify the installation was correctly achieved, issue:

% brew

If all went as expected, the command output will start with the following lines:

Example usage:
  brew search TEXT|/REGEX/
  brew info [FORMULA|CASK...]
  brew install FORMULA|CASK...
  brew update
  brew upgrade [FORMULA|CASK...]
  brew uninstall FORMULA|CASK...
  brew list [FORMULA|CASK...]
  ...

Install the main tools

Once Homebrew is correctly functioning, run the following command:

% brew install git gcc clang-format cmake

In order, these programs will be installed:

  • The git version control system
  • The gcc compiler
  • The clang-format code formatter
  • CMake a software that eases the compilation of non-trivial projects

You can verify the installation of all above programs by checking their version:

% git --version
git version 2.43.0
% g++-13 --version
g++-13 (Homebrew GCC 13.2.0) 13.2.0
Copyright (C) 2023 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.
% clang-format --version
clang-format version 17.0.6
% cmake --version
cmake version 3.28.0

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Updates may have occurred between the moment this guide was prepared and the workshop date. Therefore, discrepancies in the version numbering might be expected. Please consider this step successful if all programs are available and theversion numbers are not too far off from the ones listed.

Install Visual Studio Code

Visual Studio Code Visual Studio Code (VSCode) can either be installed using brew:

% brew install visual-studio-code

or downloading the macOS installer here.

Once done, please follow these instructions to be able to start VScode from the command line (you might be requested to type your password or scan your fingerprint).

Finally check that they worked:

% code

Software updates

Please, regularly update the packages installed with brew:

% brew update
% brew upgrade

More details are available in the brew FAQ.