Tutorial: Computer Setup

This page contains instructions for installing software needed for ROB 102. The setup for Projects 0 to 3 is different than for Project 4. For Projects 0 to 3, you will need Git, VSCode, and Docker. For Project 4, you will need Julia.

For Projects 0 to 3, follow the setup instructions below: (they should be completed in order)

  1. Git
  2. VSCode
  3. Docker

For Project 4, follow the setup instructions for Julia:


1. Git

This section guides you through the installation and setup procedure for Git. We will use GitHub to manage our code. If you do not have a Github account, go to github.com and create one. It's free!

Installing Git

Follow the instructions for your operating system. When you're done, configure Git.

Windows

We will use Git Bash to interface with Github on Windows. We will also use Git Bash as our terminal when we are developing code.

  1. Download Git: Download Git and Git Bash from here and click on the "Windows" option:
  2. Install Git: Once the download finishes, click on the installer to run it. When you are asked whether to allow the application to make changes to your computer, select "Yes."
  3. Configuring install options: The Git installer asks you to select many options during installation. In general, you can accept the default options by clicking "Continue" without changing the default values. We recommend changing only three of them:

    The default editor, Vim, is difficult to use. Change this to "Nano":
    We recommend setting the default branch name to "main":
    Select the option to checkout line-endings as-is and commit with Unix style:
  4. Once the installer finishes successfully, you should be able to open a Git Bash terminal by searching for "Git Bash" in the explorer and clicking on the application.
  5. Configure Git using the configuration instructions.

MacOS

  1. Check if Git is installed: Sometimes, Git is already installed on MacOS. To check if this is the case, open a terminal by using the Launchpad to search for "Terminal": In the terminal, type:
    git --version
    If a version prints out, you're done! Go to the instructions on configuring Git. Otherwise, move on to the next step.
  2. Install Git: If Git is not installed, you will be prompted to install developer tools. Click "Install", then accept the license agreement and wait for the software to install.
  3. Check Git is installed: Now, in a terminal, when you type git --version, version information should print out:
  4. Install Git Credential Manager: We need one more tool to let us log into Git from a laptop so we can clone and push to Git repositories. Git Credential Manager lets you log in to GitHub and it will remember you so you don't have to put in your password every time you interact with Git. First, install Brew, a package manager for Mac. Open a terminal and type:
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    Enter your password when prompted, and press Return to allow the install to start. When it finishes, in the terminal, install Git Credential Manager by entering these commands, one at a time:
    brew tap microsoft/git
    brew install --cask git-credential-manager-core
  5. Configure Git using the configuration instructions.

Linux

Check if Git is installed by opening a command prompt and typing git --version on the command line. The version will print if Git is installed. If you get a message saying the command git does not exist, install as follows:

sudo apt install git-all

Configuring Git

Once Git is installed, you should configure it with your name and email. This will help identify you as the author of code you commit. This only has to be done once. You should only do this on your own computer, not a shared computer. To set your name and email, open a terminal (for Windows, open Git Bash) and enter the following two commands, substituting your name and email:

git config --global user.name "Your Name"
git config --global user.email your@email.com

Use the email associated with your GitHub account.


2. Install VSCode

Visual Studio Code is the Integrated Development Environment (IDE) that we will be using to write C++ code. To install it, follow the instructions for your OS. Then, configure it following the configuration instructions.

Note: There is another IDE called Visual Studio. VSCode is different from Visual Studio.

Installing VSCode

Windows

  1. Download VSCode: Download the installer for VSCode for Windows from the Visual Studio website:
  2. Install VSCode: When the installer finishes downloading, click on it to run it. Click "Yes" when asked to allow the installer to make changes to your computer. Accept the default option for the installation path. If installation is successful, you should see a screen like this one:
  3. Open VSCode: Open VSCode by searching for "Visual Studio Code" in the search bar:
  4. Set Git Bash as the default terminal: In ROB 102, we will be covering how to use the command line in a Bash terminal. By default, Windows uses its own command prompt. You will set your default terminal in VSCode to Git Bash. In VSCode, open the command pallette by pressing F1 (or Ctrl-Shift-P). Search for the option "Terminal: Select Default Profile": Select the option "Git Bash": Next time you open a terminal, it should be a Git Bash terminal by default.

MacOS

  1. Download VSCode: Download the installer for VSCode for Mac from the Visual Studio website:
  2. Add VSCode to applications: When the installer finishes downloading, find the download using your Finder (look for it in Downloads):
  3. Open VSCode: Open VSCode by searching for "Visual Studio Code" in the launchpad:

Linux

Download the installer for VSCode for Linux from the Visual Studio website and follow the instructions to install.

Configuring VSCode

There are multiple extensions available to configure VSCode to your needs. We recommend installing the C/C++ extension for ROB 102. Later, you might discover more extensions that you find useful. To install an extension, select the "Extensions" icon in the bar on the left of the VSCode window. In the search bar, type "C++" and select "Install" for the extension shown below:


3. Docker

Docker allows users to run code inside containers, which are programs that emulate a specific coding environment. In ROB 102, we will run code in Docker containers which run on our computers. This will ensure that you are running your code in the exact same environment as everyone else in the class and the instructors. Docker is needed for Project 0, Project 2, and Project 3.

Installing Docker

Windows

  1. Check your Windows version: On Windows, Docker uses a program called Windows Subsystem for Linux (WSL). We need to use WSL 2, which is only available for recent versions of Windows. Make sure you have Windows 10, version 1903 or higher. Check your Windows version by searching for "About" in your Windows search bar, and select "About your PC". Your Windows version is listed under "Windows Specifications": Versions 1903, 1909, 2004, 20H2, 21H1, and 21H2 are acceptable versions.

    If your version of Windows is older that this, try upgrading your machine. You can upgrade your Windows version for free as a UM student (if your computer already has Windows). If you don't have a computer which can meet these requirements, talk to the instructors.
  2. Download Docker for Windows: Download the installer from the Docker website:
  3. Install Docker for Windows: When the installer finishes downloading, click on it to run. Make sure the options to enable Hyper V and install WSL 2 are selected, then run the installer, accepting the default options.
  4. Restart your computer: When the installer completes, you should see this message. Click the Close & Restart button to restart your computer.
  5. Launching Docker: When your computer restarts, Docker should start automatically. You should see a message telling you that WSL 2 is not installed: You might also see this error. If you do, just press "Continue".
  6. Download WSL 2: Go to this link (the same one that the message from the previous step gave you) and click on the link shown below to download the installer for WSL 2 (ignore the other instructions on the page):
  7. Install WSL 2: When the installer downloads, click to run it. You should see a screen that looks like this: Press "Next" through the options and wait for the install to finish. You will see a success screen that looks like this:
  8. Test Docker: That's it! Now we'll test that Docker was installed correctly. Open Git Bash, and enter the following command:
    docker run hello-world
    Docker should download the Docker image for the container hello-world and run it. It does nothing, so it will shutdown once a message like this one has been printed: You should also see a Docker icon in your task bar:
  9. Install Docker extensions for VSCode: Follow the instructions to install VSCode extensions for Docker.

Mac

  1. Check your chip type: If you don't already know whether you have an Intel or an Apple chip, you can find the information by typing "System Information" in your Finder. The chip type will be listed under hardware information:
  2. Download Docker: Download the correct version of Docker for your chip type from the Docker website.
  3. Install Docker: Once the download is completed, find the downloaded file, "Docker.dmg", and double click it to run it:
  4. Add Docker to applications: Once the install is completed, a window will open which prompts you to drag Docker to your applications. Do so in the window:
  5. Run Docker: Run Docker by searching for it in the Launchpad. You will need to accept to run it and provide it with priveledged access. Enter your password when prompted.
  6. Test Docker: When Docker is running, open a terminal and type:
    docker run hello-world
    Docker should download the Docker image for the container hello-world and run it. It does nothing, so it will shutdown once a message like this one has been printed:
  7. Install Docker extensions for VSCode: Follow the instructions to install VSCode extensions for Docker.

Linux

Follow the instructions here.

VSCode Docker Extensions

There are some helpful extensions for using Docker within VSCode that we will make use of. To install the extensions, open VSCode and click on the "Extensions" icon . Alternatively open Extensions with Ctrl-Shift-X (or Cmd-Shift-X on Mac). Search for "Docker" and install the extensions Docker and Docker Explorer using the "Install" button:


Julia

Julia is needed for Project 4.

Installing Julia

Windows

Download the 64-bit installer for the current stable release from the Julia downloads page. Run the installer and follow the instructions to install Julia.

Select the install executable and follow the instructions. You can select the default install location and options. On the page about additional tasks, you can choose whether you want to add a destop icon and start menu entry. It might be helpful to add Julia to your PATH variable at this step (optional):

When the installation is complete, you should see a window that looks like the one below. You can now exit out of the installer.

To open the Julia interpreter, search for "Julia" and select the Julia application.

When you launch Julia, you should see an interpreter like this one:

Mac

Go to Julia downloads page. Click the download next to macOS:

Find the downloaded .dmg file:

Double click the downloaded file in your Finder:

Click and drag the Julia logo into your Applications folder:

Find the Julia application in your Launchpad:

This will open the Julia interpreter. You may have to give your computer permission to use Julia, or give Julia permission to use your terminal.

Linux

Open a terminal and navigate to the directory where you want to put Julia. Then do:

wget https://julialang-s3.julialang.org/bin/linux/x64/1.6/julia-1.6.2-linux-x86_64.tar.gz
tar zxvf julia-1.6.2-linux-x86_64.tar.gz

You can launch Julia from the directory that you downloaded it in the terminal by doing ./bin/julia. Or, to launch from any directory, do:

export PATH="$PATH:[/path/to/julia-1.6.2]/bin"

then run julia. You can add the above line to the end of the .bashrc file so it runs each time you open a new terminal. To quit the Julia interpreter, type exit().

Installing package dependencies

You will need to install some packages that we will need to complete Project 4. Open the Julia interpreter and enter the following lines, one at a time:

using Pkg
Pkg.add("IJulia")
Pkg.add("Plots")
Pkg.add("Images")
Pkg.add("MosaicViews")
Pkg.add("MLDatasets")
Pkg.add("CSV")
Pkg.add(Pkg.PackageSpec(name="DataFrames", version="0.21.0"))

It might take some time to install all the packages! You can add other packages you might want to use this way as well.