/fswd-lab-0

Full Stack Web Development - Lab 0: Setup and Prep

Primary LanguageShell

Purpose: To prepare your laptop for running the tools we will use for class.

Goal: By the end of the lab, you will be able to open a Terminal window, run a command in Terminal, and edit a text file.

Computer Setup

Initial Tool Setup

  1. Install Homebrew
  2. Install Homebrew Cask
  3. Run brew update in the Terminal application.

Homebrew should prompt you to install the Xcode Command Line Tools. You should be able to install them by running the command xcode-select --install

Recommended Software

  1. Install Visual Studio Code: brew cask install visual-studio-code

    Other good text editors include:

  2. Install nvm: brew install nvm

Terminal and Shell Configuration

The default Terminal configuration (specifically, the setup for the "shell" tool that runs inside the eindow) can be terse. Adding the following lines to a file named .bashrc in your home directory (sometimes you'll see it as $HOME or ~, it means /Users/<your username>/) will help.

# Look for programs to run in the normal spots as well as /usr/local/bin
PATH="$PATH:/usr/local/bin"

# Looks at the git info for the current directory
function parse_git_info() {
    BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
    if [ ! "${BRANCH}" == "" ]
    then
        GIT_USER=`git config user.email`
        echo " [${GIT_USER} - ${BRANCH}]"
    else
        echo ""
    fi
}

# Set the prompt to include directory and git information
# Notice the usage of parse_git_info
PS1='\e[33m\]\u@\h\e[m\] \e[34m\]\w\[\e[m\]\e[32m\]`parse_git_info`\e[m\]\n\$ '

# Setup the nvm tool
export NVM_DIR="$HOME/.nvm"
. "/usr/local/opt/nvm/nvm.sh"

# Make the output of ls more distinctive
export LSCOLORS=exfxcxdxbxegedabagacad

# Tell the shell program to read files that contain instructions
# for completing commands and arguments when you hit the TAB key
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion

# Use atom for git operations, among other things
export EDITOR="code -w"

This file is not automatically read by the shell program in Terminal (even though the .*rc filename template is a standard one), so you will also need to create/edit a file named .bash_profile.

if [ -r ~/.bashrc ]; then
   source ~/.bashrc
fi

Other Prep Steps

  1. Sign up for a GitHub account if you do not already have one

Links and Further Reading