Skip to content

Instantly share code, notes, and snippets.

@pieterbeulque
Last active June 1, 2016 09:25
Show Gist options
  • Save pieterbeulque/4c0d61462adf0f06f12e to your computer and use it in GitHub Desktop.
Save pieterbeulque/4c0d61462adf0f06f12e to your computer and use it in GitHub Desktop.
Mac setup

Setting up a new Mac for development

Let's get you going as fast as possible.

First of all, download xCode from the App Store and install everything (including Command Line Tools).

Brew, brew, baby

Install Homebrew:

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Make sure everything is working correctly:

$ brew doctor

Install some neccessary packages and improvements:

$ brew install git wget rbenv ruby-build rbenv-aliases rbenv-rehash imagemagick ffmpeg

I prefer to install my applications through Homebrew too with brew cask.

$ brew install caskroom/cask/brew-cask; brew tap caskroom/versions

Then install some apps:

$ brew cask install --appdir=/Applications slack alfred adobe-creative-cloud iterm2 sublime-text3 the-unarchiver transmit virtualbox dropbox google-chrome fontprep sequel-pro harvest postgres 1password spectacle

Link them to Alfred (if you're using it) with $ brew cask alfred link.

Heroku toolbelt

Install the Heroku toolbelt.

Forklift

We deploy through @fd's amazing tool called Forklift.

It's installable through Homebrew too, thanks to @yvesvanbroekhoven:

$ brew install https://gist.github.com/yvesvanbroekhoven/970485a5a66efa5510ab/raw/d3cdc80e34fd41ed6ad4617924571b1e5f5bd36f/forklift.rb

zsh

I like using zsh through oh-my-zsh instead of bash.

$ curl -L http://install.ohmyz.sh | sh

Internal tools

We have our own set of tools to make life easier. More time to sip cocktails in the Bahamas 🍸

First, install the heroku pg:transfer plugin through $ heroku plugins:install https://github.com/ddollar/heroku-pg-transfer.

Then make sure you have the Mr. Henry Dropbox synced locally (or at least the tools folder). Then add that folder to your PATH:

In your ~/.zshrc or ~/.bashrc:

export PATH=~/Dropbox\ \(Mr.\ Henry\ dream\ team\)/tools:$PATH or whatever your Dropbox path is.

If you don't have access to the tools folder, the pgt (postgres transfer) method might still be useful to set up our Rails projects. If so, add this to your ~/.zshrc file.

function pgt {
  if [[ -z "$1" ]]; then
    echo "You need to give a Heroku app name without environment suffix."
    return
  fi

  if [[ "$1" == "-h" ]]; then
    echo "";
    echo "    pgt will download a database from Heroku to your local Postgres"
    echo "";
    echo "    pgt {{app}} {{env:optional}}"
    echo "";
    return
  fi

  if [[ -n "$2" ]]; then
    env="$2"
  else
    env="p"
  fi

  echo "";
  echo "Will download from $1-$env to client_${1//\-/_}_development"
  echo ""
  echo "Running:"
  echo "$ heroku pg:transfer --from DATABASE_URL --to postgres:///client_${1//\-/_}_development -a $1-$env -c $1-$env"
  echo ""
  echo "This might take a while."
  echo ""

  psql -d template1 --command="CREATE DATABASE client_${1//\-/_}_development;" > /dev/null 2>&1
  heroku pg:transfer --from DATABASE_URL --to postgres:///client_${1//\-/_}_development -a $1-$env -c $1-$env > /dev/null 2>&1
}

SSH

Don't forget to generate a new SSH key and add it to your accounts!

ssh-keygen -t rsa -C "your_email@example.com"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
pbcopy < ~/.ssh/id_rsa.pub

Your development environment

Node.js / Gulp / JSPM

We need Node.js for a lot of task running (gulp etc) so let's get that set up first.

Install the latest Node.js version (5.0.0 as of writing) from http://nodejs.org. Avoid the temptation of installing Node through brew 😉

After installing node, fix the user permissions for npm: $ sudo chown -R $(whoami) /usr/local/lib/node_modules then make sure you are running the latest npm version by installing the latest version npm install -g npm@latest.

Now install gulp globally: $ npm install -g gulp

Ruby

Our Lalala is running on Ruby on Rails so we need Ruby. Using homebrew we already have rbenv installed to manage our ruby versions, so we can just install Ruby 2.1.8 $ rbenv install 2.1.8 then set it globally $ rbenv global 2.1.8.

Now add the following to your ~/.zshrc (or ~/.bashrc):

if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi

Then run source ~/.zshrc

Now you can update your RubyGem system $ gem update --system and install Bundler gem install bundler.

Postgres

Postgres is our go-to database system. Install using homebrew $ brew install postgresql, then follow the launchd directions, then install an GUI if you want $ brew cask install postgres.

Pow

Install pow through powder for easy .dev domains. $ gem install powder && powder install.

@clrblnd
Copy link

clrblnd commented Feb 20, 2015

lekker uitgeschreven pierre <3

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