Skip to content

Instantly share code, notes, and snippets.

@JauntyJames
Last active June 14, 2018 21:22
Show Gist options
  • Save JauntyJames/ccfba5e9ebce6418fccfcb0dfeb17e2e to your computer and use it in GitHub Desktop.
Save JauntyJames/ccfba5e9ebce6418fccfcb0dfeb17e2e to your computer and use it in GitHub Desktop.
Mac dev environment setup

My personal configuration for web development

Based on Launch Academy specs with lots of my own additions

Install Chrome

Install Apple xcode command line Tools

Instructions

Note that the installation of command line tools can take a bit of time. Ensure you have a good internet connection available, and once you've begun the installation process, be prepared to take a break.

  1. Install the command line tools by entering the following command into your terminal
xcode-select --install

If the install fails, visit the Apple Developer Tools site to download and install "Command Line Tools OS X".

  1. Restart your computer.

  2. To verify that the install was successful, enter the following command into your terminal

xcode-select -p

You should see the following returned

/Library/Developer/CommandLineTools

Why?

Installation of many common Unix-based tools requires a GCC compiler. The Xcode Command Line Tools include a GCC compiler.

Install Homebrew

  1. Run this command in the terminal
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/install/master/install)"

ZOMG it's a Ruby script! It will take care of installing Homebrew for you.

  1. To verify successful installation, run in your terminal
brew doctor

and you should see

Your system is ready to brew.

Why?

Homebrew is a package management system that simplifies the installation of software.

Install iTerm2

Instructions

  1. Download

  2. Set iTerm to Reuse Previous Session's Directory by opening Iterm, and going to Iterm -> Preferences -> Profiles -> General -> Working Directory and choosing "Reuse previous session's directory".

Note: You should now use iTerm instead of terminal for everything.

Why?

The built in Terminal.app is great, but iTerm2 has some neat features that you will make your life as a developer easier. You can use either interchangeably for accessing the command line, but we recommend using iTerm2 from here on out. Once installed, use iTerm2 for all command line or terminal commands below.

Install Oh My Zsh!

Instructions

  1. Install zsh with the command:
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
  1. Verify that zsh is the default shell by going to to system preferences -> Users & Groups -> click the lock -> enter your password -> right click on your account -> hit advanced options -> verify your login shell is /bin/zsh -> if not, change it and restart your computer.

  2. Finish the Oh My ZSH installation by restarting iTerm. Be sure to completely quit iTerm by using cmd + q and relaunch the application.

Install Vim

Instructions

  1. Install it by running the following command in iTerm
brew install macvim --with-override-system-vim
  1. Set Vim as your default editor
echo "alias vim=\"mvim -v\"" >> ~/.zshrc
echo "export EDITOR=\"/usr/local/bin/mvim" >> ~/.zshrc

Why?

We want to ensure that our terminal opens up Vim by default whenever an editor is needed.

Download dotfiles

  1. Run in iterm:
cd ~ && git clone git@github.com:JauntyJames/dotfiles.git
  1. Open .zshrc and comment out the body. Add a line to the top source ~/dotfiles/.zshrc

  2. Open .vimrc and add the line source ~/dotfiles/.vimrc

  3. Open .tmux.conf and add the line source ~/dotfiles/.tmux.conf

Install chruby

  1. First, we have to check that a conflicting library is not in place. Ruby Version Manager, or RVM for short, is an alternative to chruby that you may have installed in the past. Let's check that RVM is not installed by running the following command:
rvm notes

You should get

zsh: command not found: rvm

If you do not get the expected output, uninstall RVM by running

sudo rvm implode
  1. We also need to check that we don't have another problematic application, known as MacPorts. This can cause conflicts and configuration issues with homebrew. Check that MacPorts are not installed by running
port help

You should get

zsh: command not found: port

If you do not get the expected output, you can uninstall MacPorts by following this guide.

  1. Install Chruby by running in your terminal
brew install chruby
  1. Auto-switching ruby versions should already be in the .zshrc file from the dotfiles repository. Open with vim and make sure it contains the lines:
source /usr/local/share/chruby/chruby.sh
source /usr/local/share/chruby/auto.sh

Install Ruby versions

  1. Install the Ruby version installer, ruby-install with the command below.
brew install ruby-install
  1. Install Ruby 2.3.5
ruby-install ruby 2.3.5
  1. Set Ruby 2.3.5 as your default Ruby
echo "ruby-2.3.5" > ~/.ruby-version
  1. Close iTerm and reopen it in order for these changes to take effect. Then run
chruby

You should see

* ruby-2.3.5
  1. Install Bundler
gem install bundler

Install window manager

Shiftit

--OR--

Divvy

Install Postgres.app

Instructions

  1. Download

  2. Set Postgres.app to start when you computer starts by opening the Postgres app, clicking on the elephant icon in the top menubar. Then, click Preferences. Check "Start Postgres automatically after login." In the app itself, click "Initialize" to create your database.

  3. Make sure that Postgres has been added to your path. Open ~/dotfiles/.zshrc and make sure it has the lines:

export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.6/bin
export PGHOST=localhost

Note: The version number (in this case 9.6) must match the installed version of Postgres.app. If you are unsure which version you have, type ls /Applications/Postgres.app/Contents/Versions in your terminal.

  1. Restart iTerm and run the following command in your terminal
psql

You should see something similar to this

psql (9.4.5)
Type "help" for help.

Username=#

To go back to iterm, enter \q

Generate an SSH keypair and add it to Github

  1. To generate a new keypair, run ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

  2. Press enter to accept default location.

  3. Enter a secure passphrase

  4. Start the SSH agent in the background with eval "$(ssh-agent -s)"

  5. Modify ~/.ssh/config with the following:

Host *
 AddKeysToAgent yes
 UseKeychain yes
 IdentityFile ~/.ssh/id_rsa
  1. Add your private ssh_rsa to the SSH agent and the passphrase to the keychain: ssh-add -K ~/.ssh/id_rsa

  2. Copy your public key to the clipboard with pbcopy < ~/.ssh/id_rsa.pub

  3. Go into your Github user settings and paste in the public key.

Install Docker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment