Skip to content

Latest commit

 

History

History
236 lines (145 loc) · 12.2 KB

mac-dev-tools.md

File metadata and controls

236 lines (145 loc) · 12.2 KB

Installfest Step 1: General Mac Development Tools

If you do not yet have an account for the Mac App Store, follow the instructions on Apple Support to create a Mac App Store account.

Operating System and Command Line Tools

Before class starts, we suggest you upgrade your operating system to OS X Mavericks (10.9), Yosemite (10.10), El Capitan (10.11) or Sierra (10.12). If you're on an older machine with 4GB or less of memory, please stick to OS X Mavericks. Also, if Apple releases a newer version of OS X while you're in WDI; please don't update until your instructors say it's ok.

To check what version of OS X you are running:

  1. Click the apple icon in the top left of your 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, Yosemite, El Capitan, or Sierra, detailed instructions for upgrading your operating system are available through Apple support.

Please let an instructor know if you're using an older version of OS X or if your system has less than 2 GB of memory.

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. Note: If you see an error saying that Command Line Tools are already installed, you are all set, and can move on to the Homebrew steps.
  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 Mavericks, 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

Homebrew is a package manager for OS X. We'll use to quickly download and install other tools we use, 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 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. If you are running Yosemite or later, you may recieve an error similar to the following at this step:

    `require': cannot load such file -- mach (LoadError)

    If so, you might need to change the permissions of your /usr/local directory:

    sudo chown -R $(whoami):admin /usr/local  

    If that still doesn't work, the following steps should:

    1. open terminal  
    2. $ cd /usr/local  
    3. $ git reset --hard  
    4. $ git clean -df
    5. $ brew update
  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. Based on the errors in the step above, you may need to edit your ~/.bash_profile to include the path to Homebrew if brew doctor shows warnings. If in doubt ask for help here.

    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 http://www.github.com. We will be using github.com to track code and for collaboration.

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.

  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 to help GitHub track your contributions and to make it easier and smoother to commit.

Note: Replace "YOUR-USERNAME" with your GitHub username and replace YOUR-EMAIL-ADDRESS with the email address you used to sign in to GitHub.

  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-USERNAME"
    git config --global user.email YOUR-EMAIL-ADDRESS
    git config --global credential.helper cache
    
  2. Generate a SSH key for GitHub. This will allow you to use GitHub from your Terminal without entering your login information every time you push.

    Generating SSH Keys (via GitHub.com)

Note: The layout of this GitHub walkthrough is a little unclear. You need to complete all four steps (click the four links). At the end of "Testing your SSH Connection", you should see something like, "You've successfully authenticated...." That means you're done.

Sublime Text 3

We understand some Developers prefer Atom or another text editor, but our instructional materials often reference Sublime. You may certainly use another text editor in class, but our instructional materials reference Sublime, so we recommend installing it for the sake of consistency.

  1. Use the following link to download Sublime Text 3 for Mac. To install for another system go here.

  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 very popular 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 manager to your 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 (opened with View > Show Console from Sublime menu).
    • You may need to restart Sublime Text when the install is finished.
  2. We access Package Control through the Sublime Text command palette. Open the palette by pressing cmd+shift+p from within Sublime Text. Type 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. 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.)

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

  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"
    
  2. You may see an error stating that you don't have permissions to run the command or need to agree to Xcode's terms of service. If so, run the following command, and agree to the terms if necessary:

    sudo git config --global core.editor "subl"
    

Chrome

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

Slack

You should already have Slack installed and have an account. You can run Slack in the browser without downloading anything. If you prefer, download Slack here.

Window management

While programming it's pretty common to need to place two or three windows next to each other. We'll install a program that gives us shortcut keys to do this. This step is optional.

  1. Download https://raw.github.com/onsi/ShiftIt/master/ShiftIt.zip
  2. Extract it and drag the application into your Applications directory.
  3. Double-click the ShiftIt icon in Applications and follow the instructions to enable the accessibility options.
  4. You may see an error when opening ShiftIt complaining that it is from an unidentified developer. If you do, select the Apple menu in the top-left of your screen. 5. Select System Preferences. 6. Double-click Security & Privacy. 7. Select the Lock to make changes at the bottom-left of the screen. 8. Select the Anywhere radio button to allow this app to open. - Note: For Sierra OS and beyond, the Anywhere radio button is not enabled. Follow the instructions on this link to re-enable it.
  5. You may also see an issue with the Accessibility API when opening the App. If you do, navigate to the Security & Privacy menu as above. 10. Select the Privacy tab at the top of the Security & Privacy menu. 11. Select Accessibility 12. Select the Lock to make changes. 13. Check the ShiftIt box.

ShiftIt offers a few shortcut keys like:

  • Move window to the left-half: Command+Option+Control+LeftArrow
  • Move window to the right-half: Command+Option+Control+RightArrow
  • Maximize a window: Command+Option+Control+M

You can try this now.

Dash

Download Dash a fantastic application that organizes API documentation for developers. We'll use it more later as we dive deeper into the rich world of languages, frameworks, and libraries.

Postman

Postman is a great Chrome extension that allows you to interact with APIs. Add it to your browser by going to this link.

Shortcut keys

By the way, developers LOVE shortcut key combinations. All of the shortcut keys listed above have special abbreviations. If you have time later, you can read about those abbreviations and some shortcut key combinations here. You should now see the ShiftIt icon in your menu-bar (at the top of your screen).

ON TO STEP 2: NODE.JS AND EXPRESS STACK