Convert Figma logo to code with AI

thoughtbot logolaptop

A shell script to set up a macOS laptop for web and mobile development.

8,492
1,908
8,492
0

Top Related Projects

2,190

👢 Bootstrap your macOS development system.

41,118

🍺 The missing package manager for macOS (or Linux)

paul's fish, bash, git, etc config files. good stuff.

macOS development environment setup: Easy-to-understand instructions with automated setup scripts for developer tools like Vim, Sublime Text, Bash, iTerm, Python data analysis, Spark, Hadoop MapReduce, AWS, Heroku, JavaScript web development, Android development, common data stores, and dev-based OS X defaults.

Quick Overview

Thoughtbot's Laptop project is a script to set up macOS or Linux machines for web development. It automates the installation and configuration of essential tools and software, ensuring a consistent development environment across teams or for individual developers.

Pros

  • Saves time and effort in setting up a new development machine
  • Ensures consistency across development environments
  • Easily customizable to fit specific project or team needs
  • Regularly updated to include the latest versions of tools and best practices

Cons

  • May install software or configurations that are not needed for every developer
  • Requires some familiarity with command-line tools to customize
  • Limited to macOS and Linux, not available for Windows
  • Some users may prefer more control over their development environment setup

Getting Started

To get started with the Laptop project:

  1. Open Terminal on macOS or Linux
  2. Run the following command:
bash <(curl -s https://raw.githubusercontent.com/thoughtbot/laptop/main/mac)
  1. Follow the on-screen prompts to complete the installation
  2. Optionally, customize the script by forking the repository and modifying the mac or linux files

Note: It's recommended to review the script contents before running it on your machine.

Competitor Comparisons

2,190

👢 Bootstrap your macOS development system.

Pros of strap

  • More customizable with user-specific dotfiles and Brewfile support
  • Includes additional features like disk encryption check and Xcode CLI tools installation
  • Actively maintained with recent updates

Cons of strap

  • Less opinionated, requiring more user configuration
  • May require more setup time for new users
  • Focused primarily on macOS, less portable to other systems

Code comparison

strap:

#!/bin/bash
set -e

# Check if we need to ask for sudo password
sudo -v

# Keep-alive: update existing `sudo` time stamp until `.macos` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &

laptop:

#!/bin/bash
set -e

# Welcome to the thoughtbot laptop script!
# Be prepared to turn your laptop (or desktop, no haters here)
# into an awesome development machine.

fancy_echo() {
  local fmt="$1"; shift

Summary

strap offers more customization and macOS-specific features, while laptop provides a more opinionated, cross-platform setup. strap may require more initial configuration but allows for greater flexibility. laptop offers a simpler out-of-the-box experience but with less room for customization. Both scripts aim to automate development environment setup, with strap focusing on macOS and laptop being more platform-agnostic.

41,118

🍺 The missing package manager for macOS (or Linux)

Pros of brew

  • Broader package management system for macOS and Linux
  • Larger community and more extensive package repository
  • Regularly updated and maintained by a dedicated team

Cons of brew

  • More complex setup and usage for beginners
  • Can potentially conflict with system-installed packages
  • Requires more manual configuration for development environments

Code Comparison

laptop:

#!/bin/bash

fancy_echo() {
  local fmt="$1"; shift
  printf "\\n$fmt\\n" "$@"
}

brew:

module Homebrew
  module_function

  def install
    raise FormulaUnspecifiedError if ARGV.named.empty?
    ARGV.resolved_formulae.each do |f|
      install_formula(f)
    end
  end
end

Summary

laptop is a focused script for setting up development environments on macOS, while brew is a comprehensive package manager. laptop offers a simpler, opinionated setup process, whereas brew provides more flexibility and a wider range of packages. The choice between them depends on the user's needs and experience level.

paul's fish, bash, git, etc config files. good stuff.

Pros of dotfiles

  • More comprehensive and customizable setup, including various dotfiles and configurations
  • Includes browser-specific settings and extensions for web developers
  • Offers a wider range of tools and utilities beyond basic development setup

Cons of dotfiles

  • Potentially overwhelming for beginners due to its extensive customizations
  • May require more manual intervention and tweaking to suit individual needs
  • Less focused on providing a standardized development environment across teams

Code Comparison

laptop:

#!/bin/sh

fancy_echo() {
  local fmt="$1"; shift
  printf "\\n$fmt\\n" "$@"
}

dotfiles:

#!/bin/bash

# Colors
ESC_SEQ="\x1b["
COL_RESET=$ESC_SEQ"39;49;00m"
COL_RED=$ESC_SEQ"31;01m"
COL_GREEN=$ESC_SEQ"32;01m"
COL_YELLOW=$ESC_SEQ"33;01m"

Summary

laptop focuses on providing a streamlined, opinionated setup for development environments, particularly suited for Ruby and web development. It's designed to be easily adoptable across teams.

dotfiles offers a more personalized and extensive configuration, catering to web developers with a broader set of tools and customizations. It provides a richer set of dotfiles and configurations but may require more effort to tailor to individual needs.

macOS development environment setup: Easy-to-understand instructions with automated setup scripts for developer tools like Vim, Sublime Text, Bash, iTerm, Python data analysis, Spark, Hadoop MapReduce, AWS, Heroku, JavaScript web development, Android development, common data stores, and dev-based OS X defaults.

Pros of dev-setup

  • More comprehensive setup, including data science and machine learning tools
  • Detailed documentation and explanations for each component
  • Supports both macOS and Ubuntu

Cons of dev-setup

  • Less frequently updated compared to laptop
  • More complex setup process due to its extensive coverage
  • May include unnecessary tools for some users

Code Comparison

laptop:

#!/bin/bash

fancy_echo() {
  local fmt="$1"; shift
  printf "\\n$fmt\\n" "$@"
}

dev-setup:

#!/usr/bin/env python

import subprocess

def run_command(command):
    process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    output = process.communicate()[0].decode('utf-8')
    return output

laptop focuses on a simple Bash script for setup, while dev-setup uses Python for more complex operations and cross-platform compatibility. laptop's approach is more straightforward and easier to maintain, but dev-setup offers more flexibility and power for handling diverse setups across different operating systems.

Both projects aim to automate development environment setup, but they cater to different user needs. laptop is ideal for those seeking a quick, opinionated setup for Ruby and web development, while dev-setup is better suited for users requiring a more extensive toolkit, especially in data science and machine learning fields.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Laptop

Laptop is a script to set up a macOS laptop for web and mobile 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.

Requirements

We support:

  • macOS Sonoma (14.x) on Apple Silicon and Intel
  • macOS Ventura (13.x) on Apple Silicon and Intel
  • macOS Monterey (12.x) on Apple Silicon and Intel

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

Install

Download the script:

curl --remote-name https://raw.githubusercontent.com/thoughtbot/laptop/main/mac

Review the script (avoid running scripts you haven't read!):

less mac

Execute the downloaded script:

sh mac 2>&1 | tee ~/laptop.log

Optionally, review the log:

less ~/laptop.log

Optionally, install thoughtbot/dotfiles.

Debugging

Your last Laptop run will be saved to ~/laptop.log. 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 us. Or, attach the whole log file as an attachment.

What it sets up

macOS tools:

  • Homebrew for managing operating system libraries.

Unix tools:

  • Universal Ctags for indexing files for vim tab completion
  • Git for version control
  • OpenSSL for Transport Layer Security (TLS)
  • RCM for managing company and personal dotfiles
  • The Silver Searcher for finding things in files
  • Tmux for saving project state and switching between projects
  • Watchman for watching for filesystem events
  • Zsh as your shell

Heroku tools:

GitHub tools:

Image tools:

Programming languages, package managers, and configuration:

  • asdf-vm for managing programming language versions
  • Bundler for managing Ruby libraries
  • Node.js and npm, for running apps and installing JavaScript packages
  • Ruby stable for writing general-purpose code
  • Yarn for managing JavaScript packages
  • Rosetta 2 for running tools that are not supported in Apple silicon processors

Databases:

  • Postgres for storing relational data
  • Redis for storing key-value data

It should take less than 15 minutes to install (depends on your machine).

Customize in ~/.laptop.local

Your ~/.laptop.local is run at the end of the Laptop script. Put your customizations there. For example:

#!/bin/sh

brew bundle --file=- <<EOF
brew "Caskroom/cask/dockertoolbox"
brew "go"
brew "ngrok"
brew "watch"
EOF

default_docker_machine() {
  docker-machine ls | grep -Fq "default"
}

if ! default_docker_machine; then
  docker-machine create --driver virtualbox default
fi

default_docker_machine_running() {
  default_docker_machine | grep -Fq "Running"
}

if ! default_docker_machine_running; then
  docker-machine start default
fi

fancy_echo "Cleaning up old Homebrew formulae ..."
brew cleanup

if [ -r "$HOME/.rcrc" ]; then
  fancy_echo "Updating dotfiles ..."
  rcup
fi

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 and gem_install_or_update can be used in your ~/.laptop.local.

See the wiki for more customization examples.

Contributing

Thank you, contributors!

By participating in this project, you agree to abide by the thoughtbot code of conduct.

Edit the mac file. Document in the README.md file. Update the CHANGELOG. Follow shell style guidelines by using ShellCheck and Syntastic.

brew install shellcheck

Testing your changes

Test your changes by running the script on a fresh install of macOS. You can use the free and open source emulator UTM.

Tip: Make a fresh virtual machine with the installation of macOS completed and your user created and first launch complete. Then duplicate that machine to test the script each time on a fresh install thats ready to go.

License

Copyright © 2011 thoughtbot, inc. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About thoughtbot

thoughtbot

This repo is maintained and funded by thoughtbot, inc. The names and logos for thoughtbot are trademarks of thoughtbot, inc.

We love open source software! See our other projects. We are available for hire.