Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Install Git

Git is a version control system that allows you to track changes to your code and collaborate with others. It is necessary to install Git in order to clone your repository and pull code from the skeleton repository.

This step will depend on your operating system:

  • Windows:
  • MacOS:
    • Install Homebrew, a package manager for MacOS, by following the instructions at https://brew.sh/
    • In the terminal, install Git by running brew install git
  • Linux/Other:
    • Use your system’s package manager (apt, dnf, pacman, etc) to install git. For example, Ubuntu users should run sudo apt install git.

To verify that Git is installed, open up your terminal (Git Bash on Windows), and run git --version. You should see something like git version [numbers].

Install Rust

Rust is a programming language designed for performance, safety, and concurrency. It is the language that you will be using in this course.

To install Rust, follow the instructions at https://www.rust-lang.org/tools/install. It’s suggested that you use rustup, which will automatically install cargo and rustc for you.

To verify that Rust is installed, run rustup --version. You should see something like

rustup 1.25.1 (bb60b1e89 2022-07-12)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.65.0 (897e37553 2022-11-02)`

but with different numbers.

Install wasm-pack

Rust can compile code to WebAssembly, which allows us to build web pages with Rust. The wasm-pack tool helps us generate Javascript bindings for those web pages.

To install wasm-pack, follow the instructions at https://rustwasm.github.io/wasm-pack/.

To verify that wasm-pack is installed, run wasm-pack --version. You should see something like wasm-pack [numbers].

Install a Text Editor

You will need a text editor to write and edit your Rust code. The instructions in this course assume that you are using Visual Studio Code (VSCode), but you can use a different text editor if you prefer (such as Atom, Sublime, or Neovim).

To install VSCode, go to the VSCode download page and follow the instructions.

Install the rust-analyzer extension

The rust-analyzer extension provides intelligent code completion and other helpful features for working with Rust in your text editor.

If you are using VSCode, open the “Extensions” panel in the laft sidebar, and search for the “rust-analyzer” extension. You can also find the extension here: https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer

If you are using a different text editor, you can find instructions to install it here: https://rust-analyzer.github.io/. Any text editor that supports the Language Server Protocol will support rust-analyzer.

Install Python

Python is a programming language that is commonly used for a wide range of tasks. In this course, you will use Python to run a local web server to test your code.

To install Python, go to the Python download page and follow the instructions. Make sure to install Python 3, not Python 2.

If you prefer not to install Python, you can use an alternative like http-server to run a local web server.

Set up a local repository

A repository is a directory that contains your project files and stores them in a version control system (in this case, Git). You will need to set up a repository in order to clone the skeleton code and push your own code to Github.

  • If you haven’t already, make an account on Github. You’ll need to create either a personal authentication token or an SSH key for your account; instructions on creating a PAT are here.
  • On github, create a new, private repository. You can name it anything.
  • Clone your new repository (git clone https://github.com/yourusername/example-name.git). Git may give you a warning (“You appear to have cloned an empty repository”), which is completely fine.
  • Your new repository will be receiving code updates from multiple remotes, so you need to tell Git to merge commits on pull. cd into your new repository, and run
     git config pull.rebase false
    
  • In your new repository, add the skeleton repository as a remote:
     git remote add skeleton https://github.com/sberkun/61b_rust_skeletons.git
    
  • Pull code from the skeleton, and push it to your private repo:
     git pull skeleton main
     git push
    
  • Open your new repository on Github. If you see the skeleton code, congratulations! You have successfully set up your repository.