associatedpress / laptop

A shell script which turns your Mac into an awesome web development machine.
Other
2 stars 0 forks source link

Laptop

Laptop is a script to set up an OS X computer for web development.

It can be run multiple times on the same machine safely. It installs, upgrades, or skips packages based on what is already installed on the machine.

This particular version of the script is geared toward beginners who want to set up a Ruby on Rails environment on their Mac. More advanced users can easily customize the script to install additional tools. To see an example of a more advanced script, check out 18F/laptop.

Requirements

I support clean installations of these operating systems:

Older versions may work but aren't regularly tested. Bug reports for older versions are welcome.

Install

Begin by opening the Terminal application on your Mac. The easiest way to open an application in OS X is to search for it via Spotlight. The default keyboard shortcut for invoking Spotlight is command-Space. Once Spotlight is up, just start typing the first few letters of the app you are looking for, and once it appears, press return to launch it.

In your Terminal window, copy and paste each of these two commands one at a time, then press return after each one to download and execute the script, respectively:

git clone https://github.com/associatedpress/laptop.git
cd laptop
bash mac 2>&1 | tee ~/laptop.log && source ~/.rvm/scripts/rvm

The script itself is available in this repo for you to review if you want to see what it does and how it works.

Note that the script will ask you to enter your OS X password at various points. This is the same password that you use to log in to your Mac.

Once the script is done, quit and relaunch Terminal.

What it sets up

It should take less than 40 minutes to install (depends on your machine and internet connection).

Customize in ~/.laptop.local

# Go to your OS X user's root directory
cd ~

# Download the sample file to your computer
curl --remote-name https://raw.githubusercontent.com/monfresh/laptop/master/.laptop.local

# open the file in Sublime Text
subl .laptop.local

Your ~/.laptop.local is run at the end of the mac script. Put your customizations there. You can use the .laptop.local you downloaded above to get started. It lets you install the following tools (commented out by default):

To install any of the above tools, uncomment them from .laptop.local by removing the #. For example, to install CloudApp, your .laptop.local should look like this:

#!/bin/sh

# brew_cask_install 'atom'
brew_cask_install 'cloud'
# brew_cask_install 'firefox'
# brew_cask_install 'iterm2'

Write your customizations such that they can be run safely more than once. See the mac script for examples.

Laptop functions such as fancy_echo, brew_install_or_upgrade, gem_install_or_update, and brew_cask_install can be used in your ~/.laptop.local.

Debugging

Your last Laptop run will be saved to a file called laptop.log in your home folder. Read through it to see if you can debug the issue yourself. If not, copy the lines where the script failed into a new GitHub Issue for me. Or, attach the whole log file as an attachment.

Credits

This laptop script is forked from Moncef Belyamani's laptop script, which in turn was inspired by thoughbot's laptop script.

Public domain

thoughtbot's original work remains covered under an MIT License.

My work on this project is in the worldwide public domain, as are contributions to my project. As stated in CONTRIBUTING:

This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication.

All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.