Set Up Your Mac¶
Throughout the semester, you should prioritize using the computers (in TCL 217A and TCL 216) to work on your lab assignments. All the utilities you need have already been installed on them, and they have been set up so students do not face any platform-dependent issues. However, you may also work on your personal computer and, indeed, must do so during the first week.
This document gives you instructions on how to set up your personal Mac.
If you face any problems, please reach out to the CSCI 134 staff before your first lab is due.
Note
Each person’s computer is different, and while these instructions work for most of them, there will inevitably be some unique issues and quirks that you may experience and learn how to workaround. If you encounter any such issues, please drop us a note.
Step 0. Verify macOS Version¶
You must have macOS 10.15 or 11 installed. If you have an older version, you need to upgrade it (for free). To find your macOS version, click on the “Apple” icon on the top left of the screen, and then on “About this Mac”.
If at any point in the setup process below you are prompted to install Xcode or Rosetta, please do so. These tools are essential to make this setup work.
Step 1. Add the Terminal Application to Your Dock¶
Step 2. Establish your CS credentials¶
Computer Science runs its own network of servers, with access limited to students with CS “credentials”. These credentials will be sent to you via email (with the Subject Line “Williams Computer Science Account Information”), and you are expected to change your password by following the instructions in that email. Notice that your CS username is slightly different from William’s username. Sharing your CS credentials with others is violation of the Honor Code.
To verify your credentials, type the following into the Terminal at the $
prompt, replacing
your-username
with your CS username.
ssh your-username@lohani.cs.williams.edu whoami
You may get the following message back:
The authenticity of host 'lohani.cs.williams.edu' can't be established.
ECDSA key fingerprint is ....
Are you sure you want to continue connecting (yes/no/[fingerprint])?
This is normal whenever you access a machine for the first time. If this happens, type yes, and press return/enter.
You will be asked for your CS password: provide it. Note that for security reasons, you will not see anything you type. After you enter, if the server prints out your CS username, then your credentials are working correctly. If you have trouble with establishing access, please email csaccounts@cs.williams.edu.
Step 3. Configure Git¶
Git is installed with the Mac operating system. It may, however, need to turn on various programming features on the Mac. In the Terminal window type:
git --version
It may respond with a dialog box with the message the “git” command requires command line developer tools. Would you like to install the tools now? These tools are important. Press Install, agree to the license agreement, and then press Done when the installation is finished. (It may take some time, so make sure your machine is attached to power.)
Next, you should configure git with your email and username. Execute
the following commands in the Terminal, replacing your-williams-id@williams.edu
with your Williams email address
and your-CS-username
with your CS user name.
git config --global user.email 'your-williams-id@williams.edu'
git config --global user.name 'your-CS-username'
git config --global push.default simple
git config --global pull.rebase false
git config --global core.editor nano
Step 4. Install Python¶
We’ll be using the Python programming language, version 3. You must install Python3. We suggest you do a fresh install even if you have an older python version available.
Go to https://www.python.org/downloads/. It should give you a download specific to your machine. Be sure the download option’s version number starts with 3.9 or 3.10. Once downloaded, click and install the package. Provide your Mac password, if necessary.
After the installation, a Finder window opens to the Python 3.9 applications. It contains two useful scripts we suggest you run: (a) Double-click on Install Certificates.command. This will be helpful in establishing secure connections. When it is finished, dismiss the window. (b) Double-click on Update Shell Profile.command. This will make sure this version of Python is the preferred version.
After the installation, exit out of all applications, including the Terminal.
Reopen the terminal window and type:
python3 --version
This should report the version you just installed, which will likely be
Python 3.9.1
or something similar.Upgrade the Python package installer,
pip3
. In the Terminal window type the following and enter your personal Mac password as necessary.sudo -H pip3 install --upgrade pip
Note that the above command is installing new applications on your computer, and thus the password you should use is your personal Mac password (that is, do not use your CS credentials here.)
Now that
pip3
is available, we can use it to install Python packages that we will need this semester. Run the following installation commands:sudo pip3 install jupyterlab sudo pip3 install matplotlib
Ignore warnings about running as root if they show up.
Step 5. Install Atom¶
You need to install Atom as an editor for your programs. Download it from https://atom.io/. After it downloads, you may need to move the downloaded application into the Applications folder.
Step 6. Setup CS134 Folder and Clone the Lab 1 Repository¶
Now are you ready to create your CS134 directory on your computer. Unix directories correspond to folders in your Mac or Windows operating system. You will be creating many files on your computer for this class. We suggest that you put all of your work in a single folder, called cs134, located in your home directory. You can navigate to your home directory from within the Ubuntu terminal as follows:
Open the Terminal, and run the command
pwd
(print working directory). This tells you the path of your current working directoryAs you can see above, by default you will likely be in your home directory under your username. This is a good place to create your new cs134 directory. You can always navigate to your home directory, by typing the following (
~
stands for home directory).cd ~
You can create your cs134 directory using the
mkdir cs134
(short for make directory). Now if you use the command ls to list the contents of your current directory, you should see the newly created cs134 folder.We can navigate into the folder with the command
cd cs134
(short for change directory). Since this is an empty folder right now, if you typels
, it will not show any contents.Now that you have created your cs134 folder, this is where you should always navigate to before you clone all your lab files.
Now we are ready to clone a test repository from Evolene. To clone you repository, type the following command, replacing
22xyz3
with your CS username.git clone https://evolene.cs.williams.edu/cs134-labs/22xyz3/lab01.git
Here,
evolene.cs.williams.edu
is the full name of the git server dedicated to holding our collective work. Thecs134-labs
reference is the CS134 lab directory on that server, andlab01.git
is the name of the repository holding the starter files. It is the folder that contains all of your repositories on the server. You will be asked for your CS credentials. You can now check that the folder has been created by running thels
command.
Step 7. Explore Your Repository¶
The above step creates a new directory in your
cs134
folder with the namelab01
. Navigate to your lab01 subdirectory using thecd
command:cd lab01
Explore the contents of the lab01 directory by using the
ls
(list) command:ls
You should see the files
AboutMe.txt
,GradeSheet.txt
,README.md
, andhello.py
.Whenever you begin a session of work, you should make sure you get the latest copy of your work. This is called pulling the repository from the server. You should:
git pull
Since we just cloned the repository, it’s unlikely that anything is out-of-date. Still, we always perform this simple check.
Back to Lab 1!¶
If you’ve made it this far, congratulations! Now, you’re ready to begin programming. Please continue with the Hello and Goodbye exercise from Lab 1.