Command Line Tools

A command-line interface or command language interpreter (CLI), also known as a terminal, is a means of interacting with a computer program where the user issues commands to the program in the form of successive lines of text.

Throughout the course we will emphasize use of the terminal and executing commands within it as our modus operandi.

Mac Users

A command line interface comes already installed with OSX.

You will need to install some other software from the terminal throughout the course, so it will be useful to install some additional "command line tools" now.

Opening a Terminal Session

To open a terminal session:

  • Open spotlight with cmd + space
  • Type in 'terminal'
  • When the terminal appears, open it.

Department Managed Macs

Unfortunately, installation of Homebrew requires admin rights which aren't available on laptops newly issued by the department. Please move on to the next installation step Text Editor.

Installing the X-code Tools

We want to install 'X-code command line tools'. Copy and paste the following and press Return

sudo xcode-select --install

If you get a message that the command line tools are already installed, you can continue to the next step.

Installing Homebrew Package Manager

Homebrew is a package manager for Mac.

Install Homebrew by opening a terminal and pasting the following command:

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

Verify that Homebrew installed correctly, enter the following into your terminal:

brew doctor

And you should see the following output:

Your system is ready to brew

Before continuing, lets be sure everything in Homebrew is up to date by entering the following:

brew upgrade

brew upgrade on UZH MacOS

We've seen some problems running brew upgrade on UZH computers with MacOS. If you are experiencing this, run the following two lines:

sudo chown -R "$USER":admin/usr/local/Cellar

and

sudo chown -R "$USER":admin/usr/local/share


Windows Users

On Windows we will be using "winget" for most of our installations.

Winget Installation

Winget is part of Microsoft's App Installer which you can get here. Follow the link and install the application from the Microsoft Store. On machines managed by the department you might get a "failure" pop up, but just wait, it will install.

After installation, open the Windows Search Bar and type "cmd" and hit return. This will open the Command Line Interface (CLI) of Windows with which we will be working during this course.

Now type the following command into the CLI and press return

winget --help

Upon succesful installation, you should see a long this of possible command that "winget" can be supplied with. It should start like this:

Windows Package Manager v1.5.2201
Copyright (c) Microsoft Corporation. All rights reserved.

Feel free to try some commands such as "list" to see which programs are installed on your machine.

Windows Terminal Installation

In order work more comfortably with the CLI we will install a better version of the CLI you just used.

To install "Windows Terminal" copy and paste the following command and accept the EULA when prompted, by typing 'yes' and hitting return:

winget install -e --id Microsoft.WindowsTerminal

Here, install tells winget which action it is supposed to take and "--id" is a flag providing winget with further information. In this case the id of the program we want to install and "-e" tell it to only use exactly this id. You would have been able to find this "id" by running the command:

winget search WindowsTerminal

Head over to the search in Windows and type "terminal" and hit return to open the WindowsTerminal. We will continue installations there.