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.
We support:
- macOS High Sierra (10.13)
- macOS Mojave (10.14)
- macOS Catalina (10.15)
Older versions may work but aren't regularly tested. Bug reports for older versions are welcome.
Open Terminal and Install xcode select:
xcode-select --install
Create you SSH key and link to your Github Account:
ssh-keygen -C [email protected]
Enter a location to save the save the key. Press enter to save it in the default location, or enter a new location. If you save it in the default location, all ssh connections will use this key by default. You should only need to save it in a non default location if you use multiple keys.
# Enter file in which to save the key (/Users/USERNAME/.ssh/id_rsa):
Can also keep it simple and just press enter when prompted for the above.
Be sure to add a password to your key to ensure the security of our servers. This won't need to be a password you remember, as the ssh agent can remember it for you (see below). So that being said, the best course of action is to use a generated password through Dashlane.
Set your identity in the SSH Config: This will fix an issue when running deployments where you get permission denied from Github, since our local private keys are used by Capistranto when pulling the code.
touch ~/.ssh/config
echo 'UseKeychain yes' >> ~/.ssh/config
echo 'AddKeysToAgent yes' >> ~/.ssh/config
echo 'IdentityFile ~/.ssh/id_rsa' >> ~/.ssh/config
Add the new SSH key to your terminal instance to prevent need to enter SSH password:
ssh-add -K
Link your SSH key with your Github Account. First, copy the SSH key to your clipboard.
cat ~/.ssh/id_rsa.pub | pbcopy
Github > Profile > Settings > SSH and GPG Keys > New SSH key.
Download the computer setup repository to your root directory and move the mac script there too:
cd ~ && git clone [email protected]:sprk/laptop.git
cp ~/laptop/mac ~/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
In iTerm2:
Preferences > Profile > Command:
Send text at start: ssh-add -K
In Terminal, let GitHub know who you are:
git config --global user.name "Your Name"
git config --global user.email [email protected]
Important: Your computer has been through a lot since running this script. Restart it and move onto the next step.
rbenv install 2.6.5
rbenv global 2.6.5
Relaunch your terminal.
gem install bundler
gem install rails
rbenv rehash
cd ~/Sites
git clone [email protected]:sprk/spark.git
cd spark
Note: If you want Spark to be installed a directory other than 'sites', the following will need to be updated:
In itermocil/spark.yml - (code ~/.itermocil/spark.yml)
windows:
- name: Spark
root: ~/Sites/spark
In zshrc - (zshconfig)
# FOLDER ALIASES
alias si='cd ~/Sites/Spark'
Create the master key and copy the variable that has been shared with
you in the Dashlane "Sharing Center" under "Rails - Credentials Master Key"
touch config/master.key && open config/master.key
Populate your private variables in the zshrc private file:
open ~/.files/zshrc/private
SPARK_SEED_ADMIN_EMAIL="[email protected]"
Unless you have received an aws access key id and secret key, leave these variables as is.
Setup your local database and put your computers username in the designated field.
cp config/settings.local.example.yml config/settings.local.yml
open config/settings.local.yml
Ensure yarn is setup correctly.
yarn install --check-files
Create and Populate your local database:
rboot
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.
macOS tools:
- Homebrew for managing operating system libraries.
Unix tools:
- Exuberant 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
- RipGrep as a faster alternative to the Silver Surfer
- Tmux for saving project state and switching between projects
- Watchman for watching for filesystem events
- Zsh as your shell
GitHub tools:
- Hub for interacting with the GitHub API
Image tools:
- ImageMagick for cropping and resizing images
Programming languages, package managers, and configuration:
- Node.js and NPM, for running apps and installing JavaScript packages
- Ruby stable for writing general-purpose code
- Yarn for managing JavaScript packages
Databases:
Programs:
- Brave Browser Like Google Chrome but with built in privacy / ad-blockers.
- Dashlane our password management tool.
- Firefox always good to have a secondary browser. Plus nice dev tools.
- iTerm2 your standard terminal... upgraded.
- Postman for Spark API queries.
- PSequel for checking out your local database.
- Slack office communications/chat channels.
- VSCode only code editor a sane person will ever need.
It should take less than 15 minutes to install (depends on your machine).
Edit the laptop
file.
Document in the README.md
file.
Follow shell style guidelines by using ShellCheck and Syntastic.
brew install shellcheck
Thank you!
Spark fork maintainers (you!) + original [contributors] [contributors]: https://github.com/thoughtbot/laptop/graphs/contributors
By participating in this project, you agree to abide by the thoughtbot code of conduct.
Laptop is © 2011-2018 thoughtbot, inc. It is free software, and may be redistributed under the terms specified in the LICENSE file.
Laptop is maintained and funded by thoughtbot, inc. The names and logos for thoughtbot are trademarks of thoughtbot, inc.
We are passionate about open source software. See our other projects. We are available for hire.