After you have installed the development tools, follow the steps below to configure your user environment.
Make a new directory named
cs107e_hometo store course material within your home directory. The tilde character
~is shorthand for the user's home directory.
$ mkdir ~/cs107e_home
Change to this directory and clone the courseware repository. The courseware repo is used to distribute code and materials for lectures, labs, and assignments.
$ cd ~/cs107e_home $ git clone https://github.com/cs107e/cs107e.github.io Cloning into 'cs107e.github.io'...
Check: confirm directory contents
$ ls ~/cs107e_home/cs107e.github.io/cs107e/bin pinout rpi-run.py
Note: If you're using WSL, now is a good time to open File Explorer on your
cs107e_home directory and "Pin to Quick Access" to add it the sidebar for future use. See accessing WSL files from Windows.
Edit shell configuration file
Next, configure your shell environment to match the location of your
When opening a new shell, the environment is initialized by reading a configuration file in your home directory. Editing the configuration file allows you to set the initial state of your shell.
- Determine the name of the configuration file for your shell. The name depends on which shell you are using. Use the command
echo $SHELLto see your shell. Your shell is likely
bash, although it might be
zshif using a more recent macOS.
$ echo $SHELL /bin/bash
If your shell is
bash, the configuration file is named
.bashrc. If your shell is
zsh, the configuration file is named
.zshrc. For any other shell, please contact a CA for help.
- Find out if you already have an existing configuration file or create it if needed. Change to your home directory and list the files. Filenames starting with a dot are hidden in a directory listing by default. Use the command
ls -ato list all files, including hidden ones:
$ cd ~ $ ls -a . .bash_history .bashrc cs107e_home .python_history .. .bash_logout .config .profile .viminfo
(The filenames listed in your directory may be somewhat different, don't worry!) Look through list to see if there is already a configuration file for your shell. If not listed, use
touchto create an empty file with the appropriate name:
$ touch .bashrc
- Open the configuration file in a text editor and append the following two lines verbatim:
export CS107E=~/cs107e_home/cs107e.github.io/cs107e export PATH=$PATH:$CS107E/bin
The first line sets the environment variable
CS107Eto the path to where the class files are stored. The second line adds our
binsubdirectory to your executable path.
- Use the
sourcecommand to read the updated configuration file into your current shell:
$ source ~/.bashrc
Check: confirm current shell is properly configured
$ echo $CS107E /Users/student/cs107e_home/cs107e.github.io/cs107e $ ls $CS107E/lib/libpi.a /Users/student/cs107e_home/cs107e.github.io/cs107e/lib/libpi.a $ which pinout /Users/student/cs107e_home/cs107e.github.io/cs107e/bin/pinout
The configuration file is persistent and should be automatically read when creating a new shell in the future.
Check: confirm shell configuration is persistent and future shells properly configured
Close your current shell and open a new one. Repeat the check step above in the new shell and confirm the new shell is also properly configured.
If you confirm your configuration is persistent, skip Step 5 below. If it is not persistent and you are using
bash and macOS Terminal, use the additional customization in Step 5 to add persistence.
- (only if needed) Find the file named
.bash_profilein your home directory. If no such file exists, use the
touchcommand to create an empty file with that name. Open that file in a text editor and append the following line verbatim:
Repeat the previous check step with a new shell to confirm your configuration is now persistent.
Configure git identity
We distribute course materials as git repos and you will use git to access, manage, and submit your work.
The commands below will properly set the identity recorded with your git actions. Be sure to replace
email@example.com your own.
$ git config --global user.name "My Name" $ git config --global user.email firstname.lastname@example.org
Check: confirm your git identity
$ git config --get-regexp user user.name My Name user.email email@example.com
Use the Final check steps to confirm your entire environment.