Software used in the course
The concepts covered in this module are generic and should work on any Unix system (Linux, Mac OS, BSD, WSL...). Therefore, you can use your personal machine for the labs.
Installing a Unix environment
First, you have to install a Unix environment on your laptop. For that, you have several solutions.
- For the Mac users, good news, MacOS is already a Unix system. You can start a terminal by clicking on Terminal in /Application/Utilities.
- For the Windows users, it's not more complicated, you just have to install the
Windows Subsystem for Linux (WSL).
You can find the installation guide here.
When you start WSL, this launch a terminal.
The first time you start the terminal, run the command sudo apt-get update to be sure that you have the latest version of the packagesOnly use the WSL terminal in the course. Especially, don't use the default terminal of Windows (PowerShell), which is very different from the WSL terminal
- For the most adventurous students, you can install a complete Linux system on a second partition, while keeping your current operating system (e.g., you Windows or your MacOS). For a first Linux installation, we advise you to use Ubuntu or Debian. There is plenty of documentation for these systems, and they are relatively easy to use. For the PC users, you can use this tutorial, and for the Mac users, you can use this one.
Compilation tool chain
Now that you have a Unix environment, you need to install some applications: gcc, make, libc, gdb, git and cmake.
For the Linux and Windows/WSL users
You can install all of these packages at once with the command:
MacOS users
To install the compilation tool chain on a MacOS, you first have to type
You will also need gdb to debug your code. Installing gdb is not easy on a MacOS. However, the compilation tool chain of MacOS comes with an equivalent tool named lldb. You can find how to translate the gdb given in the course on this page.
Finally, you will need cmake and git. For that, you have to install a Unix package manager on your mac. You can use either macport or brew. Install one of these package managers, and then, in a terminal, type sudo port install cmake git if you use macport, or brew install cmake git if you use brew.
Code editor
Finally, you need a code editor to edit your C and C++ code. There are many different code editors. One of the easiest at the beginning is vscode, you can download it from here.
If you are more adventurous, you can try emacs or vim. These code editors are very powerful, but the interface is not what we can call user friendly. If you want to try, on a Linux or Windows/WSL, just type apt-get install emacs or apt-get install vim. On a MacOS, you already have the emacs and vim commands installed. However, they run directly in the terminal, which is maybe not very convenient for a beginner. For an emacs with a graphical user interface, you can use Emacs for MacOS X. The default configuration is not perfect because the shortcuts to type the characters commonly used when programming are not properly configured (e.g., braces, brackets). To have a correct configuration, you have to edit the file ~/.emacs with emacs ~/.emacs and type:
Special characters on a Mac
For the Mac iusers, you need to learn the shortcuts for typing commonly used characters when programming. The Alt key is called option on a Mac keyboard. These shortcuts should be the same in both the terminal and your code editor.
- Shift-Alt-( : [
- Shift-Alt-) : ]
- Shift-( : {
- Shift-) : }
- Alt-n : ~
- Shift-Alt-l : |
- Shift-Alt-/ : \