We are super excited to get started this semester and we have a lot to cover in 10 weeks. This homework is to help you get set up with some of the basic tools we will be using this semester.
Don't worry if you don't finish. We will be helping helping people out during lab on the first day.
There are four parts to this homework:
There is no submission for this homework
Homebrew is a package manager that simplifies the installation of software through the command line interface
Step 1: Installing Command Line Tools for Mac OS
Launch the Terminal, found in /Applications/Utilities/
Type the following command string:
xcode-select --install
A software update popup window will appear that asks: “The xcode-select command requires the command line developer tools. Would you like to install the tools now?” choose to confirm this by clicking “Install”, then agree to the Terms of Service when requested (feel free to read them thoroughly, we’ll be here)
Wait for the Command Line Tools package download to complete, it’ll be about 130MB and installs fairly quickly depending on your connection speed.
Step 2: Install Homebrew
Homebrew, "the missing package manager for OS X," allows you to easily install hundreds of open-source tools. The full installation instructions are available in the Homebrew Documentation, but you should only need to run the command that's listed at the top of the Homebrew site.
Run this command inside your terminal:
/usr/bin/ruby -e "$(curl -fsSL <https://raw.githubusercontent.com/Homebrew/install/master/install>)"
Once the installation is successful, run the following command:
brew doctor
If you get Your system is ready to brew
, you can move on to Step 3. Otherwise, go to the call an instructor to help troubleshoot. (Page to troubleshoot)
Windows Subsystem for Linux (WSL) is a Windows 10 feature that allows running native Linux command-line tools possible directly on Windows
Step 1: Enabling the "Windows Subsystem for Linux" feature
Search for "PowerShell" in the Start menu
Right click and select "Run as an administrator"
Type the follow command string:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Restart your computer when prompted
Step 2: Install the Linux Distribution
Step 3: Initialize Ubuntu
Open the newly installed Ubuntu app
You will be prompted to create a new user account with a password
sudo
when you elevate a processUpdate and upgrade your packages
sudo apt update && sudo apt upgrade
Step 1: Installing Rub
We will be using rbenv
for our ruby version manager
brew install rbenv ruby-build
# Add rbenv to bash so that it loads every time you open a terminal
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
source ~/.bash_profile
# Install Ruby
rbenv install 2.6.3
rbenv global 2.6.3
ruby -v
After the last command you should see something like the following
ruby 2.6.3p62
Step 2: Installing Rails
gem install rails -v 6.0.0
rbenv rehash
rails -v
After the last command you should see something like the following
Rails 6.0.0
Step 1: Installing Ruby
Install necessary dependencies for Ruby.
Since we just updated our package library, we don't need to do sudo apt update
again, but it is a good idea to always run the command before installing a new package to ensure an up-to-date installation.
sudo apt-get install git curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev
We will be using rbenv
for our ruby version manager
cd
git clone <https://github.com/rbenv/rbenv.git> ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
git clone <https://github.com/rbenv/ruby-build.git> ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
rbenv install 2.6.3
rbenv global 2.6.3
ruby -v
After the last command you should see something like the following
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
Install bundler which is a package manager for Ruby projects
gem install bundler
rbenv rehash
Step 2: Installing Rails
In order to use the dependencies that Rails ships with, we need to install NodeJS, which is a cross-platform JavaScript runtime
curl -sL <https://deb.nodesource.com/setup_8.x> | sudo -E bash -
sudo apt-get install -y nodejs
We can now finally install Rails
gem install rails -v 6.0.0
rbenv rehash
rails -v
After the last command you should see something like the following
Rails 6.0.0
Git is the version control system of choice among many web developers.
Install Git
brew update
brew install git
Since we just installed Homebrew, we could have skipped brew update
, but it's a good habit to run it before installing anything with Homebrew because Homebrew is updated regularly.
To verify:
git --version
You should get git version 2.23.0
or later.
Run brew doctor
to make sure everything is still working. If your system is ready to brew, you can move on.
We installed Git when installing the large list of dependencies before installing Ruby.
You can verify with:
git --version
You should get git version 2.17.0
or later.
Configure Git with GitHub
Most of the time when we edit code we want to store it in GitHub so that we can have others see and or contribute to our code as well as get credit for out work so lets configure out Git to have it linked to our GitHub. If you do not have a GitHub account make an account by clicking here.
Configure your git setting to match GitHub
git config --global user.name "Your name here"
git config --global user.email "[email protected]"
Make sure the email you use is the email associated with your GitHub account.