Skip to content

Latest commit

 

History

History
163 lines (99 loc) · 8.77 KB

mac-dev-tools.md

File metadata and controls

163 lines (99 loc) · 8.77 KB

Installfest Step 1: Mac Development Tools

Operating System & Command Line Tools

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:

  1. Click the apple icon in the top left of your computer screen.
  2. Select "About This Mac" from the dropdown menu.
  3. 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.

Install Command Line Tools from the Terminal

  1. Open the Terminal application.
  2. In your Terminal, type xcode-select --install, and a new window and installer will appear.
  3. Follow the instructions in the installer.

Install Command Line Tools through Xcode (Older Versions of OS X)

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.

  1. Open the Mac App Store and install Xcode.
  2. Open Xcode.
  3. Inside the Xcode menu, choose Preferences > Downloads > Install The Command Line Tools.
  4. Follow the instructions in the installer.

Homebrew

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.

  1. Open the Terminal application, and run which brew to check if you have Homebrew installed already. The which 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.

  2. 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.

  3. Run brew update to update Homebrew.

  4. 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!

  5. You may need to edit your ~/.bash_profile to include the path to Homebrew if brew doctor shows warnings.

    $ bash echo 'export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"' >> ~/.bash_profile
  6. 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 like ls). Enter the following command in your Terminal:

    $ brew install tree
  7. Run the Terminal command tree to see a tree view of all the files inside your current directory!

Git

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.

Confirm Install

  1. 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.

  2. Only if you do not have git installed, run the following command in your Terminal:

    $ brew install git

Configure Git

Configuring your git settings will help GitHub track your contributions and to make it easier and smoother to commit changes.

  1. 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
  2. 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.

Sublime Text

  1. Use this link to download Sublime Text 3.
  2. Open the downloaded file.
  3. Follow the installation instructions (drag Sublime Text 3 to your Applications folder).
  4. Open the Sublime Text 3 application.

Add Package Control

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".

  1. 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.
  2. 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.

Add Packages

  1. Let's install our first package, Emmet. From the command palette (cmd + shift + p), select Package Control: Install Package to bring up the list of available packages.
  2. 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.

Open Sublime from the Terminal

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).

  1. 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
  2. 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
  3. Type subl . in the Terminal, and Sublime Text 3 should open!

Configure Git to Use Sublime

When you forget to enter a commit message in the Terminal, git opens a text editor and reminds you to add a commit message.

  1. 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

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.

  1. 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)"
  2. Open up your Terminal preferences, and in the "General" tab, make sure you have /bin/zsh as the command your shell opens with:

    screen shot 2015-10-25 at 16 08 17

Chrome

  1. If you don't already have it, download and install the Chrome web browser.