Development Environment: Tools

To work on the code in the class, you need the following command-line tools:

The following additional command-line tools are very useful:

Use the following for your particular development environment. Some commands have a button to copy to the clipboard so you can paste them into the shell.

Windows: WSL

To work on Windows, you must set up WSL (Windows Subsystem for Linux). WSL gives you a proper Linux distribution, with a bash shell. While git bash is sufficient for entering git commands, it does not provide a very good environment to use or add the other tools you need.

To install WSL, follow the instructions at Install WSL

After you have installed WSL, you can do the rest of the WSL setup at Set Up WSL.

After that, open a WSL shell and enter the following command to see which Linux distribution you are using:

Now, follow the instructions for Linux & WSL.

Linux & WSL

Enter the following commands into a Linux (or WSL) shell. Each command may ask you to confirm before completion.

  1. Update and upgrade your system:

  2. Install git, g++, make, ninja, and gh:

  3. The cmake build tool Ubuntu installs may be outdated. For cmake, you should have a minimum version of 3.25. Verify using the command:

    Kitware has its APT repository for Ubuntu with current cmake versions. Add the Kitware APT repository to your installation using the following commands. For more details, see apt.kitware.com.

    a. Install needed packages:

    b. Obtain a copy of the signing key:

    c. Add the repository to your sources list and update:

    d. Install the kitware-archive-keyring package to ensure that your keyring stays up to date as KitWare updates its keys:

  4. Now install cmake:

  5. Finally, individually verify that you have all these tools installed:

    For cmake, you should have a minimum version of 3.25

    Problems

    If you are having issues installing gh in WSL, then you probably have Ubuntu 20.04 installed instead of Ubuntu 22.04. To check your version of Ubuntu:

    At some point you will need to update. In the meantime, you can use the following commands to directly install gh:

    Note that to install an updated CMake, you will have to follow the directions at apt.kitware.com for Ubuntu Focal Fossa (20.04)

macOS

Enter the following commands in a macOS shell. You can get to one by using the Terminal app. The Terminal app is in the Applications folder in the subfolder Utilities. You probably want to drag it to your Dock to access it easily.

  1. The command-line tools for git, g++, and make on macOS are part of the Xcode Command Line Tools. You do not have to install the Xcode IDE to use them.

    The easiest way to install the Xcode Command Line Tools without Xcode is to install Homebrew, which you will need in the following steps.

    Follow the installation instructions at Homebrew. As part of the installation, if you haven't already installed the Xcode Command Line Tools, you'll see a message: "The Xcode Command Line Tools will be installed."

  2. There is one more issue with brew on M1 or M2 macs. The brew binaries are placed in the /opt/homebrew/bin directory, which is not on the default path used to look for commands. So for an Apple Silicon Mac (M1 or M2) only (not an Intel Mac), enter the following command:

    Close this shell and bring up a fresh one when you are done.

  3. After you upgrade, you can install ninja, cmake, and gh via brew:

  4. Finally, individually verify that you have all these tools installed:

    For cmake, you should have a minimum version of 3.25

    Note that on macOS, the command g++ runs the clang compiler, not the gcc-c++ compiler. The clang compiler is preferred on macOS because it is optimized to produce binaries for Intel and Apple Silicon (M1 & M2) CPUs. Also, clang can generate both Intel and M1/M2 binaries on either an Intel Mac or an M1/M2 Mac.