Skip to content


Subversion checkout URL

You can clone with
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: wickett/laptop
base: master
head fork: thoughtbot/laptop
Checking mergeability… Don’t worry, you can still create the pull request.
Commits on Jul 10, 2012
@mike-burns mike-burns depend on zsh publicly, and sh where possible 6045750
Commits on Jul 16, 2012
@mike-burns mike-burns Add a requirements section with zsh in it db804e4
Commits on Jul 28, 2012
@croaky croaky Remove Taps gem
* Preferred method is via `pgbackups` and `pg_restore`.
* We have a `db-load-production` script in thoughtbot/dotfiles that
  wraps up the preferred method.
@croaky croaky Improving README
* Tightened language.
* Alphabetized.
* Removed old reference to Taps gem.
@croaky croaky Remove rarely-used items
Use zsh shebangs.
Commits on Aug 02, 2012
@croaky croaky [#31] Depend on zsh publicly, and sh where possible
* This was accidentally reverted in a previous commit.
* Also fixes a typo in README.
@mjankowski mjankowski include mountain lion version in readme related to command line tools…
… installation
Commits on Aug 03, 2012
@croaky croaky [#17] Install Homebrew using Ruby 1.9.2
Some users are reporting that they've removed /usr/bin/ruby on their
machine due to other circumstances.

So, install Ruby before Homebrew, then use the Ruby we know we have.
@croaky croaky [#12] Use clang to install Ruby 1.9.2 57e5966
@croaky croaky Update Homebrew install line 9f3afd6
@croaky croaky Update RVM install line e0c721f
Commits on Aug 14, 2012
@croaky croaky Upgrade Ruby and Bundler
* Ruby 1.9.3 is working well for us on real apps in Heroku production.
* Bundler 1.2.0.rc2 provides a `ruby` directive that is becoming our
  standard for defining the Ruby version for the project.
Commits on Sep 12, 2012
@croaky croaky Remove unnecessary Ruby version install
RVM automatically installs the stable version of Ruby so we don't need
to explicitly set a Ruby version.

The current version of RVM installs Ruby 1.9.3p194.
Commits on Sep 17, 2012
Adarsh Pandit Update Credits and add LICENSE file
* Add MIT license file
* Add Credits section with copyright and contributors link
Commits on Sep 22, 2012
@croaky croaky Install reattach-to-user-namespace
* Improves tmux compatibility with other systems.
* Better copy-paste:
* Better RubyMotion:
Commits on Oct 02, 2012
@croaky croaky [#32] Run each command "successfully"
* Halt execution of the script at the point that something fails.
* Update total expected time now that `brew install qt` is faster.
* Combine scripts into one file so we don't have to duplicate or
  source the `successfully` function.
@croaky croaky Fix install for Mountain Lion and RVM 1.16
* Install Homebrew before RVM.
* Fix permissions.
* Install GCC 4.2.
* Use GCC dependencies listed by RVM.
* Use RVM version 1.15.10 because RVM 1.16.0 is broken with zsh.
* Use a one-step Ruby default.
@croaky croaky Put RVM/Homebrew settings in ~/.zshenv
Move from ~/.zshrc in order to not conflict with thoughtbot/dotfiles.
@croaky croaky Don't specify Bundler version
The latest, 1.2.1, works well with modern Ruby apps. No longer and need
to specify 1.2.x release candidates.
Commits on Oct 13, 2012
@croaky croaky Install thin
Group gem installation into one line.
Commits on Nov 02, 2012
Kevin Suttle Remove deprectated Heroku gem, add CLI client
The Heroku gem has been deprecated, and Heroku recommends installing the client CLI from It's a binary, but you can install the "standalone" version ( via wget.
Kevin Suttle Change wget to curl in Heroku CLI setup script
wget isn't pre-installed on OSX machines.
@gabebw gabebw Merge pull request #45 from kevinSuttle/patch-1
Remove deprecated Heroku gem in favor of CLI client
Commits on Nov 13, 2012
@croaky croaky Install ctags for tab completion in vim 66dc105
@gabebw gabebw Use absolute path to Heroku since the Toolbelt isn't in $PATH yet 1436452
@croaky croaky Source rvm function after install
* Follow RVM loading instructions from
* Unlock from RVM version 1.15.10, which was being used because a later
  version was broken with zsh, which has since been fixed.
Commits on Nov 16, 2012
@croaky croaky Create Postgres database after install
This follows the current instructions printed by Homebrew.
Commits on Nov 20, 2012
@croaky croaky Install Redis
It is common enough on the thoughtbot client projects I've seen this
year to want to install it on machines by default.
Commits on Nov 27, 2012
@salbertson salbertson Install watch
* example: watch heroku ps --remote production
Commits on Jan 04, 2013
@drapergeek drapergeek Update the logo to point to the assets path. 7d5023f
Commits on Jan 06, 2013
Adarsh Pandit Update copyright year range through 2013 eae2863
Commits on Jan 17, 2013
@croaky croaky Remove unnecessary bit in install instructions 4739e7b
Commits on Jan 18, 2013
Kevin Suttle Restart shell after mac script finishes
* Assure installed items and env vars apply.
* Fixes thoughtbot#63.
Commits on Feb 14, 2013
@michaelrkn michaelrkn Manage Heroku CLI with Homebrew 2b6ed80
Commits on Feb 19, 2013
@christoomey christoomey Mkdir /usr/local for Homebrew if it doesn't exist ffdec8d
Commits on Feb 20, 2013
@christoomey christoomey Merge pull request #69 from thoughtbot/ctoomey-mkdir-homebrew
Mkdir /usr/local for Homebrew if it doesn't exist
Commits on Feb 25, 2013
@croaky croaky Use rbenv to change Ruby versions
* Use Homebrew consistently for OS programs.
* Use ruby-build to install Rubies.
* Include auto-switching of Ruby in `~/.zlogin`.
* Upgrade Rubygems after Ruby is installed. This is to help avoid common
  Bundler/Psych issues:
* Use newest Bundler version in order to work with latest Rubygems.
* Use rbenv-gem-rehash so the shell automatically picks up binaries
  after installing gems with binaries.
@croaky croaky Add new libraries to README f83ce48
@croaky croaky Alphabetize libraries in README 2ce705b
@croaky croaky Force gcc-4.2 compiler when installing Ruby
Avoid errors like:

    st.c:520:35: error: implicit conversion loses integer precision:
    'st_index_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
    i = table->num_entries++; ~ ~~~~~~~~~~~~~~~~~~^~

Commits on Mar 02, 2013
@croaky croaky Install Hub gem
* Used by Suspenders' `--github organization/project` flag.
* `hub merge` for
  merging pull requests in open source projects.
* `hub browse` for opening the branch in a web browser.
* `hub pull-request` to create a pull request for the feature branch
  you're working in.
* Lots more.
Commits on Mar 04, 2013
@croaky croaky Install The Silver Searcher instead of Ack

* ag searches faster than ack
* ag searches all files by default (but still ignores gitignored files).
  This removes the need for ack's --type-add= options.
Commits on Mar 06, 2013
@croaky croaky Fix rbenv install
Error was:

    command not found: CC=gcc-4.2

* Set shell to Ruby 1.9.3 after installing it to make sure the following
 `gem` commands are using the correct Ruby.
* Use easier-to-read `--no-document` flag.
Commits on Apr 03, 2013
@Kerrick Kerrick Begin porting to ubuntu 70a3cdf
Dan Collis-Puro Debian derivative support for the Laptop script
This implements support for:
* Ubuntu quantal
* Ubuntu precise
* Debian wheezy
Commits on Apr 05, 2013
@gylaz gylaz Fix OSX zsh environment bug
* This a known bug discussed [here](sorin-ionescu/prezto#381).
Commits on Apr 09, 2013
@croaky croaky Encourage users to read script before running it
* Wrap lines at 80 characters.
* Use colons to mean "run the command on the next line."
Commits on Apr 10, 2013
@gylaz gylaz Use conventional zsh dotfile names
* move rebenv initialization from .zlogin to .zshrc
* rbenv documentation recommends .zshrc
* less files for us to manage in our home directory

* use zshrc instead of zprofile
* zprofile is just an alternative for ksh fans [source](
* Tim Pope recommends moving /etc/zshenv to /etc/zshrc [source](
@croaky croaky Restart shell as login shell after rbenv
Move `exec $SHELL -l` line to spot recommended by [rbenv README][1].

Resolves [#77][2], where users would see errors like:

    Updating rubygems-update
    ERROR: While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /Library/Ruby/Gems/1.8
    Installing critical Ruby gems for Rails development ...
    ERROR: While executing gem ... (OptionParser::InvalidOption)
    invalid option: --no-document
    Installing GitHub CLI client ...
    ERROR: While executing gem ... (OptionParser::InvalidOption)
    invalid option: --no-document

[2]: thoughtbot#77
@croaky croaky Don't open browser
* Opening the browser can surprise people.
* Use gerund in nearby command output.
@croaky croaky Fix idempotence 55d9853
@croaky croaky Remove unnecessary steps
* Permission fixing used to be necessary but Homebrew fixed this in this
* Certain system libraries used to be necessary for Ruby 1.9.3 when we
  were on RVM, which enforced certain requirements:
* Improve printed output with newlines separating commands.
* Add more idempotent checks.
* Don't restart script in the middle of the run.
* Stick to `~/.zshrc`, not `~/.zshenv`.
* Finish script with preparation of `~/.zshrc` for thoughtbot/dotfiles'
  `` script.
* Add `fancy_echo`.
Commits on Apr 11, 2013
@Kerrick Kerrick Ubuntu desktop does not come with aptitude or cURL
Since Ubuntu 10.10, aptitude has been left out of the default Ubuntu
desktop install. This commit changes the linux and linux-prerequisites
scripts to check if aptitude is installed: if it is the script continues
as normal; if it is not apt-get is used to install aptitude, and then
the script continues as normal.

This also updates README to use wget instead of cURL, and installs cURL
@croaky croaky Make sure line printed to ~/.zshrc is a comment e166b05
@croaky croaky Merge branch 'master' of 9a97d13
Commits on Apr 13, 2013
Dan Collis-Puro Feature parity with recent OS X modifications
* Removing SSH key generation
* Idempotency improvements
* Prep for dotfiles
* Install curl.
Commits on Apr 19, 2013
Dan Collis-Puro Use more active language, remove unused linux packages 94b2e9f
Dan Collis-Puro Fix contributors link bd5df3e
Commits on Apr 26, 2013
Dan Collis-Puro Update for Ubuntu 13.04: "Raring Ringtail" support 24bca6e
Commits on May 24, 2013
Dan Collis-Puro Add debian jessie (testing) to supported distros. d1fcfdc
Commits on Jun 07, 2013
@croaky croaky Upgrade to Ruby 2.0 p195 93763c8
Commits on Jun 12, 2013
@seltrus seltrus Install lzma compression library for Ag 5181480
Commits on Jul 13, 2013
Adarsh Pandit Update Ruby version to 2.0.0-p247
* Security fix release notes:
* Also, Heroku is now running the same patchlevel. Maintains dev/prod parity
@croaky croaky Switch Thin to Unicorn
As the Rails application scales to more Heroku dynos, a lack of
concurrency can result in [poor performance][1] and an over-provisioning
of resources. Modifying the app to handle requests more efficiently is
a simple process with immediate benefits.

Unicorn is a [concurrent web server][2] that spawns several processes
within a single dyno without requiring concurrency or threading
awareness in your app.  Applications that migrate to Unicorn often
require fewer dynos and see increased performance.

Commits on Jul 14, 2013
@croaky croaky Use standalone `hub`, not RubyGems version 07667be
Commits on Jul 15, 2013
@geoffharcourt geoffharcourt Remove .zshrc stub creation
Laptop currently generates a .zshrc file if one does not already exist.
However, this file is created with the # DO NOT EDIT BELOW THIS LINE
comment that does not fit with the new thoughtbot/dotfiles convention
of storing changes in .local files instead of above the placeholder
comment. If a user attempts to run laptop and then install dotfiles,
the dotfiles installation will not install .zshrc because of the
existing stub.

This change removes the creation of the .zshrc stub for both mac and
linux scripts.
Commits on Jul 21, 2013
Ian Chiles check for curl in prereqs
Fixes a problem installing hub using curl
Commits on Jul 25, 2013
Daniel Collis-Puro Merge pull request #115 from IanChiles/master
check for curl when installing on linux
Commits on Jul 29, 2013
@croaky croaky Remove duplicate Foreman install
Heroku Toolbelt includes Foreman. Installing the gem in addition to
Toolbelt may cause future problems. For example, the Toolbelt is
auto-updating and the gem isn't. So, we might run into weird problems
with an out-of-sync foreman vs Heroku command-line tool.

Thanks, @jonmountjoy.
@croaky croaky Fix OpenSSL::SSL::SSLError
Some users see SSL certificate errors when making API requests from
Ruby. For example:

    SSL_connect returned=1 errno=0 state=SSLv3
    read server certificate B: certificate verify failed
Commits on Aug 01, 2013
@croaky croaky Load Ruby 2 `gem` command before installing gems 4072713
Commits on Aug 12, 2013
@croaky croaky Install vim from Homebrew
Using the latest vim gets us snytax highlighting and other things that
could otherwise be different from system vim.

For example:

Commits on Aug 16, 2013
Dan Collis-Puro Componentize laptop
Refactor laptop to componentize the creation of the `linux`, 'mac` and
`linux-prerequisites` laptop files, which will allow us to share similar
tasks and configurations.  IMPORTANT: `/bin/` must be run before each
commit to re-render the laptop files. See `` for details.
Commits on Aug 30, 2013
@pbrisbin pbrisbin Fix invalid conditional 3bf8ea0
@pbrisbin pbrisbin Make bin/build more idiomatic
* `printf` is more portable and consistent than `echo`
* $( ) is allowed and preferred
* Always quote all variables
* Useless use of `cat`
* Remove uneeded permissions setting
@pbrisbin pbrisbin Regenerate compiled scripts de52188
Commits on Aug 31, 2013
@pbrisbin pbrisbin Use set -e and trap rather than "successfully"
Behavior should be identical. set -e will cause any failing command to
exit and the trap will output "failed" on stderr, like successfully used
@pbrisbin pbrisbin Regenerate compiled scripts 682323b
Commits on Sep 20, 2013
@thcipriani thcipriani Ensure .bin directory exists in $HOME and in $PATH c56f081
Commits on Sep 23, 2013
@thcipriani thcipriani Change echo to printf in common-components 4cce175
Commits on Sep 27, 2013
@pbrisbin pbrisbin Remove dist-upgrade from linux scripts 28fac68
@pbrisbin pbrisbin Add initial laptop test using precise d2f4f5e
@pbrisbin pbrisbin Add documentation around testing 279168a
Commits on Oct 18, 2013
Dan Collis-Puro Support Ubuntu 13.10 bede758
Commits on Nov 01, 2013
@derekprior derekprior Do not rehash on rbenv initialization
We install rbenv-gem-rehash, which will automatically rehash when you
install new binaries, so I can't conceive of why this is necessary. I've been
using --no-rehash for months now without issue, and there's a noticeable speed
up in shell initialization.
Commits on Nov 08, 2013
Dan Collis-Puro Add libreadline-dev to linux install
Without libreadline-dev installed, IRB and the rails console won't
function properly.
Commits on Nov 11, 2013
Dan Collis-Puro Update about Ubuntu 13.10 support 07fa54d
@gabebw gabebw Add C compiler installation instructions for 10.9
Reformat C compiler instructions for various OS X versions so people can scan by
their version of OS X.
Commits on Nov 19, 2013
Paul Smith & Trace Wax Fix QT on Mavericks 4e525c8
Commits on Nov 23, 2013
@esbanarango esbanarango Change brew url. 91d91fa
Commits on Nov 24, 2013
@dayne dayne rejiggered homebrew for #156 41a057f
@dayne dayne Make Homebrew install idempotent fbb2e9f
Commits on Nov 28, 2013
@croaky croaky Use updated Qt formula for Homebrew
The `--HEAD` flag is no longer necessary:

Commits on Dec 01, 2013
@geoffharcourt geoffharcourt Use Ruby 2.0.0.p353 as default
Resolves reported vulnerability in p247.
@croaky croaky Configure Bundler for parallel gem installs
* Set it globally for OS X.
* Determine number of cores dynamically.
* Pick one number less than number of cores to avoid deadlock errors.
* Only install `--pre` for Bundler.
* Remove `pg` and `unicorn` gems as they will be installed during `bundle`
  for a Rails project.
Commits on Dec 05, 2013
@pbrisbin pbrisbin Fix homebrew conditional 8a8c7a7
Commits on Dec 06, 2013
@mike-burns mike-burns Add rcm
The rcm suite of tools are used to manage dotfiles. They can symlink
dotfiles from a repo into your homedir, turn an existing configuration
file into a symlinked dotfile, and in general make it easy to try new
dotfile repos.
Commits on Dec 27, 2013
@mike-burns mike-burns Use thoughtbot/rcm for Homebrew
Back when rcm was an experiment by Mike Burns, the `homebrew-rcm` GitHub
repo was hosted under the `mike-burns` account. It has since been moved
to `thoughtbot` so that more may share in the love.
Commits on Dec 28, 2013
@marcdel marcdel Change Homebrew install path
Looks like it's hosted in a different repository now.
@chip chip Add command for accepting XCode agreement on Mavericks f899ebf
Commits on Jan 09, 2014
@croaky croaky Upgrade Ruby to 2.1.0 aae0a21
@pbrisbin pbrisbin Remove initdb, fixes #182
The latest Homebrew formula runs this as part of post-install.
Commits on Jan 17, 2014
Dan Collis-Puro Improve idempotency in the linux laptop script
These changes allow the laptop script to run more than once and can be
tested through ./test/  The only significant side effects are:

* Gems (pg, rails, unicorn) will be updated
* ruby $RUBY_VERSION will be set as the global ruby if it wasn't already
* rubygems proper will be updated to the latest release
* hub will be updated
* the heroku toolbelt will be updated.
Commits on Jan 27, 2014
Adarsh Pandit Update license to 2014 59fe5b5
Commits on Feb 05, 2014
Matthew Sumner Use correct thoughtbot/homebrew-formulae repo bc04d0e
Commits on Feb 07, 2014
@jsuchal jsuchal Install gems after configuring bundler for parallel installation. 499c816
@pbrisbin pbrisbin Remove linux-prereq script by switching to Bash
Required changes:

* Change #!
* Move pre-req actions directly into linux
* Switch uses of $+command for which (zsh-ism)
* Don't source ~/.zshrc to pickup new exports
* Add setting of zsh as $SHELL
* Update README

Ancillary changes:

* Switch [ with [[ (best practice)
* Switch if-newline-then with if; then (style)
* Use $( ) and $(( )) (best practice)
* Switch wget with curl (consistency)
Commits on Feb 09, 2014
@arnaudbouffard arnaudbouffard change thoughtbot/rcm to thoughtbot/formulae
Started reading the thoughtbot playbook last week, which led me to laptop. Calling mac from Terminal went fine untill the last installation which yielded "ERROR: no available formula for rcm". Googling the error message brought me to Matthew Sumner's commit # 2915cf1f696777a7438d0bbf92f688f32e1e8264 in the dotfile repo. Applying the same modif to the laptop mac shell script got rid of the error message. If you accept my pull-in request, that'd be my first ofishal contribution to the open source world.
Commits on Feb 10, 2014
@acconrad acconrad Update mac file to tap from thoughtbot/formulae
In reference to [this pull](thoughtbot/dotfiles#222)
Commits on Feb 17, 2014
Dan Collis-Puro Linux: Add nodejs for rails asset pipeline rendering 2960dbe
Dan Collis-Puro Linux: Add sqlite3-dev and sqlite3 cli 7c9eacb
Commits on Mar 01, 2014
@croaky croaky Update Homebrew even if already installed c6a4aec
Commits on Mar 03, 2014
@croaky croaky Install Suspenders instead of Rails
We more typically create Rails apps using Suspenders. Rails is a
dependency of Suspenders, so it will still be installed.
Commits on Mar 04, 2014
@pbrisbin pbrisbin Replace all uses of echo with printf
The echo builtin is very unportable and should be avoided. More
information can be found here:
Commits on Mar 14, 2014
@croaky croaky Use Homebrew for `hub` on OS X
The previous method places the `hub` command in ~/bin/hub, which shows
up in the dotfiles repo for thoughtbot/dotfiles users. We could
gitignore the `bin/hub` gem there, but the hub README recommends using
Homebrew or a package manager when it is available.

This leaves the Linux version functionally the same.
Commits on Mar 15, 2014
@croaky croaky Upgrade Ruby to 2.1.1 ddb1728
@croaky croaky Fix test broken by ddb1728 1528479
Commits on Mar 17, 2014
@croaky croaky Start Postgres after it is installed
* Set up plist so Postgres will start up at login.
* Create file for other potential `brew services start` lines. Redis?
Commits on Mar 20, 2014
@croaky croaky Allow personal customizations via ~/.laptop.local
Use same `.local` convention as
Commits on Mar 28, 2014
Dan Collis-Puro Test all officially supported linux distros
Includes more thorough rails-level tests and docs for the
Dan Collis-Puro Fix how we source personal additions to laptop
If the file ~/.laptop.local doesn't exist, the laptop script returns a
failing exit code. This doesn't really make sense, and gets in the way of our
test runner.  Wrap this in slightly more verbose `if` to ensure a
successful exit code.
@croaky croaky Don't hardcode Ruby version
* Use endpoint.
* We'll update the file when necessary, which is stored on S3 and served
  via Fastly.
* Apply style guideline: "Use snake_case for variable names and ALLCAPS
  for environment variables."
Commits on Apr 08, 2014
@croaky croaky Fix "Could not verify the SSL certificate" errors
The error message indicates the connection failed because OpenSSL was
unable to verify the server certificate. The SSL certificates that comes
with Mac OS X 10.8 may be outdated.

This also should help avoid critical OpenSSL errors:

@croaky croaky Build "linking OpenSSL" change from 44a5266 c772e88
Commits on Apr 11, 2014
@croaky croaky Use command -v to test command existence
Use preferred POSIX `command -v` test for command existence instead of
previous `which` technique. `which` exits with status `1` if nothing is
found. That would cause the script to abort because we use `set -e`.
Commits on Apr 14, 2014
@croaky croaky Make mac script run idempotently
Use preferred POSIX `command -v` test for command existence instead of
previous `which` technique. `which` exits with status `1` if nothing is
found. That would cause the script to abort because we use `set -e`.

Remove GCC dependency in mac script

GCC is no longer necessary to compile Ruby. It was fixed in Ruby about
two years ago. LLVM has been supported since 1.9.3-p125.
Commits on Apr 21, 2014
Dan Collis-Puro Fix ruby-build errors with ruby 2.1.1
Apply mislav's patch
sstephenson/ruby-build#526 (comment)
against a readline bug in newer rubies. Should fix #219 and #218, and
we'll remove when a new ruby is released or if ruby-build patches this
bug itself.
Dan Collis-Puro Remove support for EOL'd ubuntus: 12.10 and 13.04 ae3983f
Commits on Apr 22, 2014
Dan Collis-Puro Ubuntu 14.04 LTS (Trusty Tahr) support 85e2bbb
Commits on Apr 30, 2014
@wouterw wouterw Update github raw urls a845aa8
Commits on May 02, 2014
Daniel Collis-Puro Merge pull request #222 from wouterw/patch-1
Update github raw urls
Dan Collis-Puro Automatically create laptopped vagrant boxes.
Vagrant boxes can be created automatically after a successful run of the
laptop test suite. These vagrant boxes are published to
[vagrantcloud]( and should be a
solid start on a vagrant dev box suitable for modern ruby and
ruby-on-rails development.

Improvements include:

* Vagrantfiles fixed to have predictable names
* test/ now knows how to render vagrant boxes after tests are
* Error reporting improvements
* Full documentation on creating new base boxes

We now require vagrant >= 1.5.0 to use the automated test suite built
into laptop.
Commits on May 05, 2014
Dan Collis-Puro Remove the deprecated curl-ca-bundle b3b1ac2
Commits on May 09, 2014
Dan Collis-Puro Install silversearcher from apt when possible 0db0892
Commits on Jun 06, 2014
@jrafanie jrafanie Support rerunning the installation script by restarting postgresql.
If postgresql was installed and started in a previous run, start causes:
Error: Service `postgresql` already started, use `brew services restart postgresql`

When developing changes to these scripts, it's important to be able to run and rerun this script without removing applications.
Daniel Collis-Puro Merge pull request #235 from ManageIQ/support_reruns_where_pg_is_started
Support rerunning the installation script by restarting postgresql.
Dan Collis-Puro Refactor automated laptop tests to use rspec

* A minimal gem, rake, and rspec environment
* The Distro class wraps up commands to test and provision vagrant boxes
* Publishing boxes to s3 has been simplified and improved
* Significant documentation updates

New laptop specs should now be significantly easier to write and understand.
Commits on Jun 13, 2014
@endSly endSly brew-cask formula updated in README b7df9dd
Daniel Collis-Puro Merge pull request #236 from endSly/patch-1
brew-cask formula updated in README
Dan Collis Puro and Dan Croak Install nvm and node on Mac laptops

* Installing nvm via homebrew
* Adding node init stubs to .zshrc
* Installs node 0.10.28 and uses it by default
Dan Collis-Puro Clarify the simpler "vagrant init" way to spin up a prerendered box 747d998
Commits on Jun 17, 2014
@ash106 ash106 Remove spaces in node_version variable definition. 6b0e554
Commits on Jun 20, 2014
@chrispwood chrispwood Making brew installs commands work in idempotently dc7a475
Dan Collis-Puro Extend and improve osx idempotency

* Fix the "brew_install_or_upgrade" function, use it for all components
* Remove executable perms
* Skip installing an already installed ruby

Technically re-running laptop is not idempotent in that it will upgrade
brew-installed items and potentially install a new ruby. I feel this
is expected and wanted.
Dan Collis-Puro Remove ruby 2.1.1 conditional behavior for rbenv installation 4ad53bc
Dan Collis-Puro Be more careful about nvm init in zshrc fdc9ba5
Commits on Jun 22, 2014
@allaire allaire Fix nvm package install be03d4a
Daniel Collis-Puro Merge pull request #241 from lodgem/fix-source-zsh
Fix nvm package install
Commits on Jul 07, 2014
@sarahgp sarahgp Fix rbenv initialization for zsh
Clean install on OSX Mavericks 10.9.4, I encountered an error similar to this:


Implemented same zsh fix, seemed to work alright. I think this is what needs to
be changed in the code.
Commits on Jul 09, 2014
@seanpdoyle seanpdoyle Installs `parity`
* `curl` / `heroku-toolbelt` / `pg_restore` should all
  already be available
Commits on Jul 10, 2014
@mike-burns mike-burns Install foreman on OS X
This uses installer(1).

On GNU we already install `heroku-toolbelt` using apt, and that package
has a dependency on the `foreman` package.

We install this via installer(1) instead of gem(1) so that it remains
regardless of the development Ruby setup.

We install this via installer(1) instead of from the `Gemfile` so that
it remains regardless of what other developers do on the project (as
described by David Dollar).
@mike-burns mike-burns Use root to run the installer(1) 49b8b38
Commits on Jul 22, 2014
@croaky croaky Switch to launchctl for Postgres
`brew services` is no longer supported:


* Fixes thoughtbot#93
* Fixes thoughtbot#243
* Idempotently creates Postgres database cluster and starts (or restarts)
Commits on Jul 23, 2014
@croaky croaky Log the output of the script to a file and stdout
Thanks for the implementation, @pbrisbin.
@gohanlon gohanlon Update prerequisites in README
Homebrew's install script checks whether the command line tools are installed,
and, only if necessary, will run `xcode-select --install`.

The test they are using depends in part on a heuristic:


I confirmed that it works on a clean 10.9 install.

We also should not instruct the user to run `sudo xcodebuild -license` at all.

Here's why:

The `xcodebuild program` isn't included in OS X Mavericks. When you run
`xcodebuild`, you're actually finding one of 83 shims found in `/usr/bin` that
are included in Mavericks. These shims are an important part of how the
`xcode-select` mechanism works. When the command line developer tools have not
been installed, invoking any of these shims won't do anything other than prompt
you to install the command line developer tools:

    $ xcodebuild -license
    xcode-select: note: no developer tools were found at
    '/Applications/', requesting install.
    Choose an option in the dialog to download the command line developer tools.

(And, the GUI install dialog is presented.)

Of course, since the real `xcodebuild` program isn't actually available, it
doesn't make sense to try and use it to accept the Xcode License Agreement.

Instead, go straight to installing with `xcode-select --install` (xcode-select
comes with OS X Mavericks and is not a shim):

    $ xcode-select --install
    xcode-select: note: install requested for command line developer tools

And, the exact same GUI install dialog is presented (prompting the user to
either "Get Xcode" from the App Store or immediately "Install" the command line
developer tools).

For more about `xcode-select` and it's shims, see `man xcode-select`.

This also removes redundant Vagrant setup instructions and capitalize Vagrant.
Commits on Jul 25, 2014
@gohanlon gohanlon Don't upgrade a brew that is already up to date
Fixes thoughtbot#257

On a clean OS X Mavericks, Laptop outputs an error message towards the end of
the install script when `brew_install_or_upgrade` is invoked for OpenSSL:

    Upgrading and linking OpenSSL ...
    Error: openssl-1.0.1h already installed
    Linking /usr/local/Cellar/openssl/1.0.1h... 1139 symlinks created

The current version of OpenSSL was installed earlier as a dependency of
PostgreSQL. In general, a similar error will be logged whenever
`brew_install_or_upgrade` is called for an installed package that's already up
to date.

Currently, Laptop discards the error exit code of `brew upgrade` as follows:

    (brew upgrade "$@") || true

In addition to logging an error when there isn't truly an error, this approach
can cause real `brew upgrade` errors and potential bugs in Laptop to be masked
(e.g. Homebrew formula build failures or Laptop mistakenly invoking `brew
upgrade` for a package that isn't actually installed).

I think a better approach would be to check whether the installed package is the
same version as the current Homebrew formula before attempting `brew upgrade`.
@gohanlon gohanlon Make brew_install_or_upgrade work with aliases
Fixes thoughtbot#258

The following doesn't behave as intended:

    brew_install_or_upgrade 'postgres'

because "postgres" is an alias, not the full name of the formula. The actual
formula name is "postgresql".

The first time `brew_install_or_upgrade 'postgres'` is invoked it works as
expected — `brew install postgres` is run. Additional invocations result in
`brew install` instead of the expected `brew upgrade`.

The `brew_install_or_upgrade` function uses `brew list -1` to obtain a complete
list of installed packages, and these package names will be the actual package
names. So, grepping for an alias (with the `-x` option) won't match:

    $ brew list -1 | grep -Fx postgres

Note that there's no output, even though PostgreSQL is installed. Using the full
package name behaves as expected:

    $ brew list -1 | grep -Fx postgresql

Rather than passing on the first argument to `brew_install_or_upgrade` to the
`brew list` commands, the argument should first be expanded to the actual
package name.
@gohanlon gohanlon Test whether Homebrew formula is installed
More readable and testable this way.
@gohanlon gohanlon Fix warning when linking already-linked OpenSSL
Fixes thoughtbot#259

Laptop raises the following warning on `brew link openssl ` when OpenSSL has
already been linked:

    Warning: Already linked: /usr/local/Cellar/openssl/1.0.1h
    To relink: brew unlink openssl && brew link openssl

I think the resolution is straightforward: follow Homebrew's recommendation and
`brew unlink` before `brew link`. I verified that `brew unlink` exits with
success even if the formula wasn't previously linked as would be the case the
first time Laptop is installed.
@gohanlon gohanlon Add idempotent brew_launchctl_restart function
Fixes thoughtbot#260

This is a soft error that occurs when Laptop is run and PostgreSQL isn't
currently loaded by `launchclt`, e.g. on the first run of Laptop:

    Starting Postgres ...
    /Users/wellmade/Library/LaunchAgents/homebrew.mxcl.postgresql.plist ->
    launchctl: Error unloading: homebrew.mxcl.postgresql

The fix would probably be to check `launchctl list` to see if the service is
already loaded before calling `launchctl unload`.

This small added complexity probably justifies a function for running
appropriate `launchctl` commands. Homebrew has a strong convention for the
naming of `launchd` plists: "homebrew.mxcl.FORMULA_NAME.plist", e.g.
"homebrew.mxcl.postgresql.plist" and "homebrew.mxcl.redis.plist". This likely
makes a function to do the `launchctl` work fairly straightforward.
Commits on Jul 26, 2014
@skippednote skippednote Upgrade to latest version of Node.js
We can future-proof the script little more by setting `node_version` to 0.10.
NVM will automatically install the latest 0.10.x version:
@croaky croaky Drop support for Snow Leopard
* Snow Leopard was released in August, 2009 (about five years ago).
* Yosemite will be released in a couple of months.
* We support the last three versions of Ubuntu, so this is a little more
* Use the same format as the Linux "Requirements" section for consistency.
Commits on Jul 28, 2014
@croaky croaky Link README to programs that Laptop installs
So that users can learn more about them.
Commits on Jul 29, 2014
@croaky croaky Clarify OS X support 2aa635f
Commits on Aug 05, 2014
@jkrmr jkrmr Add compatibility for Bash 3.x
The `|&` is new in Bash 4, which is not the default on Macs.

Given that Laptop is meant to be run on a fresh machine, `2>&1 |` is preferable,
since it'll work on the Bash 3.x, which is what comes installed on new machines.
Commits on Aug 08, 2014
Dan Collis-Puro Repackage base boxes, used by rspec tests 7e7cdcf
Commits on Aug 15, 2014
Dan Collis-Puro Remove support for EOL'd ubuntu-13.10 (saucy) 5754363
Commits on Aug 31, 2014
@gohanlon gohanlon Make `brew_is_upgradable` mac function more robust
Rely on logic of `brew outdated` to decide whether a brew is upgradable.

Fixes #276 and #282:
* thoughtbot#276
* thoughtbot#282
Commits on Sep 22, 2014
@croaky croaky Don't redirect stderr to /dev/null
`&>` redirects both `stderr` and `stdout`.
`>` redirects only stdout.

Use `&>` when we explicitly want to ignore/discard error messages,
which is rarely.

`command -v` outputs only stdout.
So, `>` is appropriate because there is expected `stderr` output.
In the rare case that command fails,
we want the reason printed.
Commits on Sep 23, 2014
@croaky croaky Switch from `hub` to `gh`
[gh] is a [hub] reimplementation that's much faster and is now the official
Github CLI. It appears that "hub" is [deprecated].

[deprecated]: github/hub#475
Commits on Sep 25, 2014
@mtthwhggns mtthwhggns Update Homebrew script URL to new location 8300f93
Commits on Sep 30, 2014
@AlJohri AlJohri Add quotes around $HOME b/c path may have spaces 8066ffa
Commits on Oct 01, 2014
@croaky croaky Don't use Homebrew for rbenv
* Use the same Git/GitHub approach for Mac as we do for Linux.
* This makes upgrading easier via `git pull`.
* Add idempotency `if` guards.
* Use bash-preferred bracket-bracket style.
Simon Fixes rbenv component path in the manifest files
Commit bc5a7c6 changed how rbenv is installed
("Use the same Git/GitHub approach for Mac as we do for Linux."),
but was missing the changes in the manifest files.

This commit fixes the corresponding manifest files.
Commits on Oct 02, 2014
@croaky croaky Install Postgres via Hombrew bottle
Upstream maintainers put thought into what is
and what isn't sensible to include by default.
Those decisions establish a de facto standard
that is broader in scope than Laptop:
Homebrew users, library users, etc.

The further we stray from the defaults,
the more likely we are to run into problems,
and those problems will be harder.

The most widely experienced, most urgent,
and most rapidly fixed problems will be
problems with installing using formula defaults.
Problems from using non-defaults are relatively lonely.

Also, Homebrew bottles are awesome:

Using options forces an install from source rather than a bottle,
which is much, much slower:

> Options were passed to the install command i.e. `brew install
> $FORMULA` will use a bottled version of `$FORMULA`, but `brew install
> $FORMULA --enable-bar` will trigger a source build.
Commits on Oct 09, 2014
@kenyonj kenyonj Check for .zshrc.local before appending .zshrc 4d75fb3
@kenyonj kenyonj Create append_to_zshrc() 0f359ca
@kenyonj kenyonj Re-order manifest build order 4e7f598
Commits on Oct 10, 2014
@kenyonj kenyonj Remove explicit new line addition
Relies on `append_to_zshrc` to add a new line after the appended text.

`append_to_zshrc()` will accept a second argument (`boolean`) to skip the new
line before the appended text, by default a new line will always be prepended.
Commits on Oct 12, 2014
@gohanlon gohanlon Apple renamed "Mac OS X" to simply "OS X" with Mountain Lion (2012) 14c870b
@gohanlon gohanlon Declare support for OS X Yosemite 39768b1
@croaky croaky Drop Linux support
We don't have anyone at thoughtbot using the supported Linux versions,
which makes supporting those versions difficult:


The majority of the code in the project deals with Linux
or with the need to support multiple operating systems.
Commits on Oct 14, 2014
@croaky croaky Restrict .gitignore to only Vim files
No need to ignore Vagrant-related, Ruby-related, and other files
now that we are not supporting Linux.
Commits on Oct 16, 2014
@croaky croaky Link to Yosemite marketing page 95fbaa5
Commits on Oct 19, 2014
@ffleming ffleming Only change to zsh if it is not the shell
`chsh` requires a password input, which we want to avoid where possible.
Commits on Oct 22, 2014
@jferris jferris Don't use /etc/zshrc
* Using zshrc causes path_helper to override PATH from zshenv
* We set up rbenv among other things in zshenv

@5minpause 5minpause Changes heroku-config plugin url to use https
Many corporate firewalls block the git:// protocol.
Changing this URI to use https:// makes it usable for more people.
The other Git URIs are all using https://.
This was previously the only exception.
Commits on Oct 29, 2014
@croaky croaky Make rbenv idempotent, install Ruby 2.1.4
* Don't repeat ourselves by using variables.
* Use more consistent variable naming and use of `local` in functions.
* Use `snake_case` for variable names and `ALLCAPS` for environment variables.
* Use Bash double-bracket.
* Set current shell to newest Ruby version.
* Don't install `--pre` version of Bundler.
@croaky croaky Fix typo 7b18ef6
Commits on Nov 20, 2014
@keith keith Add $HOME/.rbenv to $PATH even if it's installed cbacb37
@keith keith Remove rbenv-gem-rehash plugin installation
This plugin was merged into rbenv
Commits on Nov 25, 2014
@croaky croaky Remove redundant Foreman
It is installed earlier via
Commits on Nov 26, 2014
@croaky croaky Remove Heroku Config
I haven't been using `heroku config:pull`, etc. for some time.
Instead, I've been using more targeted shell lines insides our
[`bin/setup`] convention, such as:

    if ! grep -F "FILEPICKER" .env > /dev/null; then
      heroku config --remote staging | grep "FILEPICKER" >> .env
      sed -i '' 's/\:/=/' .env
      sed -i '' 's/ //g' .env


This is more targeted and automated than using `heroku config:pull`.
Commits on Dec 03, 2014
Dan Croak and Ken Ip Use Homebrew for rbenv and ruby-build
* Many thoughtbot employees are successfully using Homebrew'd rbenv.
* rbenv's recommended install is Homebrew for OS X:
* We use Homebrew / package management whenever possible for
  system dependencies.
* We save a step adding rbenv to `PATH` in zshrc / zshenv,
  because Homebrew does it for us.
  This is nice because we don't add `rbenv` to `PATH` in
@croaky croaky Use ShellCheck to enforce shell style
* Document in "Contributing" section.
* Use GitHub code fences to improve syntax highlighting.
* Don't be so Rails-y in the documentation.
@pbrisbin pbrisbin Suggested installation includes an explicit review step
While we did previously state "Read, then...", that's easier to ignore.
This brings the copy-pastable commands in line with the intent: to have
the user review the script before executing it. This also removes the
potentially confusing use of process substitution.

Note: The presence of `less` is assumed to avoid assumptions about
editors or the noise of handling that robustly (e.g. `${EDITOR:-vim}`)
Commits on Dec 04, 2014
@croaky croaky Install libyaml to avoid failed Ruby compilation
I saw this problem while installing Ruby 2.1.4.
Installing libyaml first solved the problem.
Commits on Dec 05, 2014
@croaky croaky Rehash to get `bundle` command d9fe627
Commits on Dec 08, 2014
@croaky croaky Remove Parity, Watch, Suspenders, and Rails
* These are great tools, but not critical.
* Some tools should be re-installed right before their use,
  such as Suspenders.
* Restrict Laptop to more fundamental setup.
* Document how to install these in `~/.laptop.local`.
Commits on Dec 09, 2014
@croaky croaky Document that we install (or update) RCM c500edb
@croaky croaky Use `tree` as customization example
Laptop should be responsible for setting up
the compilers,
system package manager,
programming language version managers & installers,
large system dependencies such as Postgres,
and any critical config for those tools
which is often overlooked but can cause bugs and headaches.

Other useful command-line tools such as `watch` and `tree`
are better installed in individuals' `~/.laptop.local` files.

Add `tree` as a good example for that file.

Try to make `~/.laptop.local` explanation clearer
and more prominent by placing it in a heading.

Remove Suspenders as an example.
Right before using Suspenders,
it's probably best to re-install it to get the latest.
Commits on Dec 19, 2014
@croaky croaky Be more specific in printed output
* Say whether we are Installing, Upgrading, or Skipping.
* Changes the behavior of `brew_install_or_upgrade`
  but simplifies and shortens the rest of the script.
@croaky croaky Use Homebrew for Git
We previously relied on the version of Git
that comes with Xcode.
The Homebrew version is easier to upgrade
when new versions of Git are released,
such as yesterday's security patch:
@croaky croaky Use rbenv shell instead of rbenv local
`rbenv local` creates a `.ruby_version` file
in the current directory.
Commits on Dec 22, 2014
@croaky croaky Install, upgrade, or skip Bundler 5224a9d
@croaky croaky Add gem_install_or_update function
* Use it for Bundler.
* Document it for others' use in their ~/laptop.local.
* Delete out of date part of README.
Commits on Dec 29, 2014
@pbrisbin pbrisbin Remove bashisms, use /bin/sh shebang
- Remove glob within test command
- Replace [[ bashism with POSIX [
- Replace source bashism with POSIX .
- Replace (( bashism with POSIX [
- Remove process substitution bashism

Other fixes:

- Simplify return value negation
- Use grep -F for speedup on non-regex
- Use $HOME consistently over ~
@pbrisbin pbrisbin Setup travis build to run shellcheck
Disable false-positives via shellcheck declarations:

- L10: We're passing a format string as argument
- L44, etc: We want the expressions to be appended literally
Commits on Jan 12, 2015
@croaky croaky Restart Redis bfdd429
@croaky croaky Remove NVM, simplify to `brew install node`
From @derekprior:

> I never used NVM. I just kept my homebrew installed version pinned to
> the version we were using. As a company this is probably totally fine
> because we don't jump back and forth between node projects like we do
> with Ruby projects. Also, there is no "system" node to worry about.

thoughtbot#341 (comment)
Commits on Jan 16, 2015
@AlJohri AlJohri Add brew_tap function
This prevents the ugly "Warning" messages
which Homebrew outputs by default
when tapping something that is already tapped.

Sourcing this script in my personal set up,
I use it as thus:

brew_tap 'homebrew/dupes'
brew_tap 'homebrew/versions'
brew_tap 'homebrew/boneyard'
brew_tap 'homebrew/science'
brew_tap 'homebrew/php'
brew_tap 'caskroom/cask'
brew_tap 'caskroom/versions'
brew_tap 'caskroom/fonts'
brew_tap 'thoughtbot/formulae'
@croaky croaky Use newer functions in customization instructions ae5b1a1
Commits on Jan 18, 2015
@croaky croaky Fix rbenv idempotence
The `if` statement causes
rbenv to only be installed,
never upgraded.

Now that we have `brew_install_or_upgrade`,
we can eliminate the `if` statement.
Commits on Feb 03, 2015
@reshleman reshleman Correct typo in README
The sample `.laptop.local` incorrectly referred to
`gem_install_or_upgrade` instead of `gem_install_or_update`.
Commits on Feb 15, 2015
Richard Moorhead Add link to wiki from README for customizations b153d5e
@seanpdoyle seanpdoyle Revert `gh` to `hub`
`hub`, like `gh`, is now powered by the Go programming language.

Since `gh` is a GitHub CLI,
why not use the CLI created by GitHub themselves?

Additionally, `hub` handles `$ git clone thoughtbot/laptop`
out of the box.

`hub` 2.2.0 is the first stable release using Go:

It has been bottled in Homebrew:

@croaky croaky Update copyright to 2015 268f111
Commits on Feb 20, 2015
@pbrisbin pbrisbin Default $skip_new_line to 0
In Bash, `[ "" -eq 1 ]` causes:

  [: : integer expression expected

Resolves #377
Commits on Mar 07, 2015
@croaky croaky Rework thoughtbot section of README
* Update logo to use new HTTPS version.
* Change header from "Credits" to "About thoughtbot".
* Move "thank you" to contributors section.
* Make "About thoughtbot" the last thing in the README,
  with the copyrights grouped closer to the LICENSE information.
* Link to LICENSE.
* Make the community link more obvious that we have other projects.
* Finish with a CTA to hire us.
* Include `utm_source` codes to improve tracking.
Commits on Apr 08, 2015
@croaky croaky Add code of conduct 9fec1e5
Commits on May 28, 2015
@bb bb Fix rbenv init argument order
The no-rehash parameter should go in front of the shell, not behind.
The previous order was resulting in
"basename: illegal option -- -"
errors for me when using rbenv shell.
Commits on May 30, 2015
@croaky croaky Install Zsh via Homebrew
This has the added advantages of:

* Updating Zsh by re-running the Laptop script.
* Some Zsh tab completions will be automatically added to `$fpath`.
Commits on Jul 27, 2015
@xuebinglee xuebinglee Update README to reference Hub
The script installs `hub` instead of `gh` as of
commit 9fe038c.
Commits on Jul 28, 2015
s a n d a l z Link to thoughtbot/dotfiles in README 1b2c9db
Something went wrong with that request. Please try again.