If you don't already have an account for the Mac App Store, follow the instructions on Apple Support to create a Mac App Store account.
Before class starts, we suggest you upgrade your operating system to OS X Maverick or Yosemite. We don't recommend you use El Capitan yet, because some of the tools we use have not been updated for El Capitan. Do not upgrade your operating system during WDI.
To check what version of OS X you're running:
- Click the apple icon in the top left of your computer screen.
- Select "About This Mac" from the dropdown menu.
- Read the version information from the window that pops up.
If you are not using Maverick or Yosemite, detailed instructions for upgrading your operating system are available through Apple support: How to upgrade to OS X Yosemite.
- Open the Terminal application.
- In your Terminal, type
xcode-select --install
, and a new window and installer will appear. - Follow the instructions in the installer.
Only follow these steps if you were not able to install Xcode Command Line Tools with the instructions above. If you must run a version of OS X before Maverick, you will need to install Command Line Tools that come from Xcode.
- Open the Mac App Store and install Xcode.
- Open Xcode.
- Inside the Xcode menu, choose Preferences > Downloads > Install The Command Line Tools.
- Follow the instructions in the installer.
Note: When copying the code snippets, exclude the $
as you run the code in your Terminal. The $
is simply an indicator of the user in the Terminal.
Homebrew is a package manager for OS X. We'll use it to quickly download and install other tools we need, or to update already installed tools.
-
Open the Terminal application, and run
which brew
to check if you have Homebrew installed already. Thewhich
Terminal command shows where on your computer a program is installed. If it is installed, the Terminal will output a file path. If it is not installed, the Terminal won't output anything. -
Only if you do not have Homebrew installed, run the command below to install Homebrew. Wait while Homebrew is downloads and installs.
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
If you run into problems, you may need to run
rm -rf /usr/local/Cellar /usr/local/.git
and then retry the command above. -
Run
brew update
to update Homebrew. -
Run
brew doctor
in your Terminal to check that Homebrew and any current packages are installed correctly. If there are issues,brew doctor
will list suggestions for how to fix them. Follow these suggestions one by one. If you're not sure what to do, ask! -
You may need to edit your
~/.bash_profile
to include the path to Homebrew ifbrew doctor
shows warnings.$ bash echo 'export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"' >> ~/.bash_profile
-
Let's install our first package with Homebrew,
tree
! This package adds a command to your Terminal that displays files in a tree view (instead of a list view likels
). Enter the following command in your Terminal:$ brew install tree
-
Run the Terminal command
tree
to see a tree view of all the files inside your current directory!
You should already have git installed and have an account on GitHub from Fundamentals. If not, sign up for an account on github.com. We'll be using GitHub to track code changes and collaborate on projects.
-
To check whether git is installed on your system, run the Terminal command
which git
. The output should be a directory path like/usr/bin/git
. This is where git is installed on your machine. If you don't see any output, git is not installed on your computer. -
Only if you do not have git installed, run the following command in your Terminal:
$ brew install git
Configuring your git settings will help GitHub track your contributions and to make it easier and smoother to commit changes.
-
Use the following three
git config
commands to configure your git user information and have git "cache" (remember) it. We use the--global
(or-g
) option to make the configuration apply to all repositories.$ git config --global user.name "YOUR_GITHUB_USERNAME" $ git config --global user.email "YOUR_GITHUB_EMAIL_ADDRESS" $ git config --global credential.helper cache
-
Generate a SSH key for GitHub by following GitHub's instructions. This will allow you to use GitHub from your Terminal without entering your login information every time you push.
- Use this link to download Sublime Text 3.
- Open the downloaded file.
- Follow the installation instructions (drag Sublime Text 3 to your Applications folder).
- Open the Sublime Text 3 application.
Sublime Text has its own package manager called Package Control. We'll use it to add extra features to Sublime Text, including a web development shortcut package called "Emmet" and a JavaScript syntax helper "jshint".
- Follow Package Control's "simple installation" instructions to add Package Control to Sublime Text. When you paste the large block of text, make sure you:
- use the Sublime Text 3 version, and
- enter the text into the bottom rectangle of the Sublime Text console.
- We access Package Control through the Sublime Text command palette. Open the palette by pressing
cmd + shift + p
within Sublime Text. Start typing "Package Control" in the command palette to see the list of things Package Control can do.
- Let's install our first package, Emmet. From the command palette (
cmd + shift + p
), selectPackage Control: Install Package
to bring up the list of available packages. - Select
Emmet
from the list, and Package Control will install it for you! (Start typing "Emmet" in the search bar to narrow down the list.)
The other package we'll to add, jshint
, requires Node.js, so we'll get to it in the next set of installation instructions.
Sublime Text 3 includes a program that launches Sublime from the Terminal. We'll use the ln
command to link that program to a simple subl
command.
Before following these steps, make sure you downloaded Sublime Text 3, NOT Sublime Text 2. Also make sure you're running Sublime from your Applications folder NOT from the installer (go ahead and eject the installer if you haven't already).
-
To run a program from the Terminal, it needs to be available on your $PATH. The next step assumes
/usr/local/bin
is in your $PATH, so let's check that. Run the following command from the Terminal to see your current $PATH:$ echo $PATH
-
Run the following command in your Terminal to set up the link:
$ ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
-
Type
subl .
in the Terminal, and Sublime Text 3 should open!
When you forget to enter a commit message in the Terminal, git opens a text editor and reminds you to add a commit message.
-
Run the following command in the Terminal to configure git to open Sublime Text instead of the default text editor:
$ git config --global core.editor "subl"
zsh
(or "z-shell") is an alternative shell for your Terminal (the default shell is called bash
). zsh
provides features for more interactive Terminal use. We'll use oh-my-zsh to manage our zsh
configuration.
-
Paste this command into your Terminal to install oh-my-zsh:
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
-
Open up your Terminal preferences, and in the "General" tab, make sure you have
/bin/zsh
as the command your shell opens with:
- If you don't already have it, download and install the Chrome web browser.