7

GitHub - vendasta/setup-new-computer-script: This script will help with the quic...

 2 years ago
source link: https://github.com/vendasta/setup-new-computer-script
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Setup a New Developer Computer

This script will help with the quick setup and installation of tools and applications for new developers at Vendasta. Tested in Mac OS 10.14 to 12. This script hasn't been tested on M1 Macs.

You can run this script multiple times without issue. You can also run it on a partially set-up computer and it will only install what is missing.

The script will create/modify .bash_profile and .zprofile with path and autocomplete sources. If you do run it on an already set-up computer, please check these files for any duplicated paths/imports/etc.

Looking to use this script at your own company? Check out the tips for using the script at your own company section.

Installation Instructions

  • Download the script setup-new-computer.sh to your home folder

  • Open Terminal and navigate to where you saved it

  • Make the script executable:

    chmod +x ./setup-new-computer.sh
  • Run the script:

    ./setup-new-computer.sh
  • Some installs will need your password

  • You will be promted to fill out your git email and name. Use the email and name you use for Github

Post Installation Instructions

Afer you have run the script, please complete the following steps to finish setting up your computers:

  1. Github Command-line SSH Authentication
    Do the following to authorize Github on your computer:

  2. Vendasta specific tools
    Follow our onboarding document to complete your setup:

Post Installation Tips

Fix ZSH Errors
If you are using ZSH as your shell (default in newer Mac OS versions) you may get this error after running the setup script:

zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]?

You can fix this by running the following command in your terminal:

compaudit | xargs chmod g-w

Setting Up Pycharm with Mac OS Python
Vendasta Python projects Do Not Work with homebrew Python.
In Pycharm, when you choose a Project Interpreter, make a custom one set to /usr/bin/python

Mac OS Python 2 and Homebrew 3
Vendasta's Python projects do not work properly with Homebrew Python. This can cause confusion, as many tools need homebrew Python. Here is how to use the different Pythons:

The built-in Mac OS Python and it's pip are available as python and pip.
Homebrew Python 3 and it's pip is available as python3 and pip3

If pip installation fails when using sudo -H /usr/bin/easy_install pip try running sudo -H python -m ensurepip

Fix Python Google SDK errors
If you're seeing errors like ImportError: cannot import name apiproxy or other google app engine errors, try to downgrade the SDK to older version by running gcloud components update --version 359.0.0

Installing Node versions
Use nvm to install and upgrade different versions of Node. Official docs
We use the Node v14 at Vendasta.

# Install the latest version of Node 14 with NPM
nvm install 14

# Install a specific version of Node
nvm install 12      # or 10.10.0, 8.9.1, etc

Upgrading Node and NPM
There is a handy command in your .bash_profile and .zsh_profile that will automatically upgrade to the latest version of Node 14 and NPM, plus it will re-install any global packages you have installed so you do not have to manually do it each time. Read more about it here

node-upgrade        # update node 14 and reinstall all global packages

Switching Node Versions
Use nvm to switch between installed versions of Node. Official docs

# To switch to the latest Node
nvm use node        # "node" is an alias for the latest version
# Switch to long term support (lts) version of Node
nvm use --lts
 
# To switch to a specific verison of Node
nvm use 11          # or 10.10.0, 8.9.1, etc

Keeping your tools up-to-date
Homebrew can keep your commandline tools and languages up-to-date.

# List what needs to be updated
brew update
brew outdated
 
# Upgrade a specific app/formula (example: git)
brew upgrade git

# Upgrade everything
brew upgrade
  
# List previous versions installed (example: git)
brew switch git list
 
# Roll back to a currently installed previous version (example: git 2.25.0)
brew switch git 2.25.0

What's Installed

Shell Profile Setup (Bash and Zsh)

.bash_profile The following will be added to your ~/.bash_profile

.zprofile The following will be added to your ~/.zprofile

Commandline tools and languages

Xcode CLI Development Tools

Homebrew (brew)

Bash (with Bash Completions)

Zsh Completions

Git

Github CLI (gh)

Hub (unofficial commandline Github)

ack

Silver Searcher (ag)

Languages

Go

Mac OS Python (Installing Pip, Invoke, Requests, lxml, pyCrypto, Virtualenv)

Homebrew Python 3 (with pip3)

Node (from nvm, with npm, nx, husky, Angular CLI, Node-Sass, and Node-Gyp)

Ruby

Google Cloud Components

Applications

Slack

Firefox

Google Chrome

Docker for Mac

Postman

Optional IDEs and Tools

Visual Studio Code

Jetbrains Toolbox

Pycharm

Goland

WebStorm

Sublime Text

iTerm2

System Tweaks

General: Expand save and print panel by default

General: Save to disk (not to iCloud) by default

General: Avoid creating .DS_Store files on network volumes

Typing: Disable smart quotes and dashes as they cause problems when typing code

Typing: Disable press-and-hold for keys in favor of key repeat

Finder: Show status bar and path bar

Finder: Disable the warning when changing a file extension

Finder: Show the ~/Library folder

Safari: Enable Safari’s Developer Settings

Chrome: Disable the all too sensitive backswipe on Trackpads and Magic Mice

Chrome: Use the system print dialog and expand dialog by default

Set up Git

Configure git to always ssh when dealing with https github repos

Set Git to store credentials in Keychain

Set git display name and email


Tips for using the script at your own company

This script helps new developers at Vendasta setup their laptops quicker, letting them hit the ground running. Before, it could take 2-5 days to install and configure everything, leading to a frustrating first week. With this script and fast internet, the process can be done in under 30 min.

I have tried to make this script simple and useful. You will want to customize the installation and configuration to match the tools and services you use at your company.

  • At Vendasta, we are using Python 2, Go, Angular, and Google Cloud. You most likely do not use all of these, so remove, change, and tweak to meet your needs.
  • We lock our Node version at 14 (using NVM) for best compatability with Angular and NX. You will likely want to change this.
  • To customize the welcome logo and add a bit of style, I used the handy Text to ASCII Art Generator
  • When you update the script, remember to update the readme "What's Installed" section too
  • Be sure to update both the .bash_profile and .zprofile
  • This is MIT licensed, so be sure to include the LICENSE file
  • Let me know! It is good to know if you find this helpful

Resources and inspiration

The following examples were helpful in building this script.

Todo: Prep for M1 compatibility

  • Install Rosetta 2 (Is it not installed by default or automatically?)
    /usr/sbin/softwareupdate --install-rosetta
    or sudo /usr/sbin/softwareupdate --install-rosetta agree-to-license

  • Set the new M1 location of homebrew up in the path
    /opt/homebrew/bin

  • More reading:


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK