Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

This script will help with the quick setup and installation of tools and applications for new developers at Vendasta.

License

NotificationsYou must be signed in to change notification settings

vendasta/setup-new-computer-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 

Repository files navigation

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 works on both Intel and M1/M2 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 thetips for using the script at your own company section.


Quick Install Instructions

Paste the command below in a Mac OS Terminal:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/vendasta/setup-new-computer-script/master/setup-new-computer.sh)"

Manual Install Instructions

  • Download the scriptsetup-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 prompted to fill out your git email and name. Use the email and name you use for Github



Post Installation Instructions

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

  1. Github Command-line SSH Authentication
    Git is now configured to use SSH by default for github urls. You will need to generate and add an SSH key to your Github account or you will run into errors. 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 Python 2.7
As Mac OS has recently removed the bundled copy of Python 2.7, please seethis help document on working with our Legacy Appengine projects


Installing and Upgrading Node and NPM versions
There is a handy command in your.bash_profile and.zsh_profile that will automatically install your chosen version of Node and NPM, re-install any global npm packages (like angular cli), and set the newly installed version as default.

We use Node v20 at Vendasta. To upgrade to the latest version of Node 20, re-install global npm packages, and set it as default, run the following command:

node-upgrade 20

If you wish to install a version of node without reinstalling all global packages or setting it to be default, you can use NVM directly (Official docs):

# Install a specific version of Nodenvm install 18# or 10.10.0, 8.9.1, etc

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

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

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

# List what needs to be updatedbrew updatebrew outdated# Upgrade a specific app/formula (example: git)brew upgrade git# Upgrade everythingbrew 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
# --------------------------------------------------------------------# Begin Bash autogenerated content from setup-new-computer.sh   $VERSION# --------------------------------------------------------------------# Supress "Bash no longer supported" messageexport BASH_SILENCE_DEPRECATION_WARNING=1# Start Homebrewif [["$(uname -p)"=="arm" ]];then# Apple Silicon M1/M2 Macseval"$(/opt/homebrew/bin/brew shellenv)"else# Intel Macseval"$(/usr/local/bin/brew shellenv)"fi# Bash Autocompletioniftype brew&>/dev/null;thenHOMEBREW_PREFIX="$(brew --prefix)"if [[-r"${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh" ]];thensource"${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh"elseforCOMPLETIONin"${HOMEBREW_PREFIX}/etc/bash_completion.d/"*;do   [[-r"$COMPLETION" ]]&&source"$COMPLETION"donefifi# Google Cloud SDK[-e"$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc" ]&&source"$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc"[-e"$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc" ]&&source"$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc"# Golangexport GOPRIVATE="github.com/vendasta"export GOPROXY="direct"export GO111MODULE="on"export GOPATH=$HOME/goexport GOBIN=$GOPATH/binexport PATH=$PATH:$GOBIN# NVM# This needs to be after "Setting up Path for Homebrew" to override Homebrew Nodeexport NVM_DIR="$HOME/.nvm"[-s"$NVM_DIR/nvm.sh" ]&&."$NVM_DIR/nvm.sh"# This loads nvm[-s"$NVM_DIR/bash_completion" ]&&."$NVM_DIR/bash_completion"# This loads nvm bash_completion# Node# Increases the default memory limit for Node, so larger Anglar prjects can be builtexport NODE_OPTIONS=--max_old_space_size=12000# Update Node to selected version and reinstall previous packagesnode-upgrade() { new_version=${1:?"Please specify a version to upgrade to. Example: node-upgrade 20"} nvm install"$new_version" --reinstall-packages-from=current nvmalias default"$new_version"# nvm uninstall "$prev_ver" nvm cache clear}# --------------------------------------------------------------------# End autogenerated content from setup-new-computer.sh   $VERSION# --------------------------------------------------------------------
.zprofile The following will be added to your ~/.zprofile
# --------------------------------------------------------------------# Begin ZSH autogenerated content from setup-new-computer.sh   $VERSION# --------------------------------------------------------------------# Start Homebrewif [["$(uname -p)"=="arm" ]];then# Apple Silicon M1/M2 Macseval"$(/opt/homebrew/bin/brew shellenv)"else# Intel Macseval"$(/usr/local/bin/brew shellenv)"fi# Brew Autocompletioniftype brew&>/dev/null;then fpath+=$(brew --prefix)/share/zsh/site-functionsfi# Zsh Autocompletion# Note: must run after Brew Autocompletionautoload -U +X compinit&& compinitautoload -U +X bashcompinit&& bashcompinitfpath=(/usr/local/share/zsh-completions$fpath)# Google Cloud SDK[-e"$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc" ]&&source"$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc"[-e"$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc" ]&&source"$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc"# Golangexport GOPRIVATE="github.com/vendasta"export GOPROXY="direct"export GO111MODULE="on"export GOPATH=$HOME/goexport GOBIN=$GOPATH/binexport PATH=$PATH:$GOBIN# NVM# This needs to be after "Setting up Path for Homebrew" to override Homebrew Nodeexport NVM_DIR="$HOME/.nvm"[-s"$NVM_DIR/nvm.sh" ]&&source"$NVM_DIR/nvm.sh"# This loads nvm[-s"$NVM_DIR/bash_completion" ]&&source"$NVM_DIR/bash_completion"# This loads nvm bash_completion# Node# Increases the default memory limit for Node, so larger Anglar prjects can be builtexport NODE_OPTIONS=--max_old_space_size=12000# Update Node to selected version and reinstall previous packagesnode-upgrade() {readonly new_version=${1:?"Please specify a version to upgrade to. Example: node-upgrade 20"} nvm install"$new_version" --reinstall-packages-from=current nvmalias default"$new_version"# nvm uninstall "$prev_ver" nvm cache clear}# --------------------------------------------------------------------# End autogenerated content from setup-new-computer.sh   $VERSION# --------------------------------------------------------------------

Command-line tools and languages

Xcode CLI Development Tools
xcode-select --install
Homebrew (brew)
/bin/bash -c"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"# Fix brew insecure directories warning (zsh)chmod go-w"$(brew --prefix)/share"
Bash (with Bash Completions)
brew install bashbrew install bash-completion
Zsh Completions
brew install zsh-completions
Git
brew install git

Languages

Go
mkdir -p~/gobrew install gogo env -w GOPRIVATE="github.com/vendasta"
Node (from nvm, with npm, nx, husky, Angular CLI, Sass, and Node-Gyp)
getLastestNVM() {# From https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c# Get latest release from GitHub api | Get tag line | Pluck JSON value    curl --silent"https://api.github.com/repos/nvm-sh/nvm/releases/latest"|         grep'"tag_name":'|        sed -E's/.*"([^"]+)".*/\1/'}curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$(getLastestNVM)/install.sh| bashexport NVM_DIR="$HOME/.nvm"[-s"$NVM_DIR/nvm.sh" ]&&\."$NVM_DIR/nvm.sh"# This loads nvmnvm install 20npm install --location=global @angular/clinpm install --location=global nxnpm install --location=global huskynpm install --location=global sassnpm install --location=global node-gyp

We will also create a new file called~/.huskyrc and fill it with:

# --------------------------------------------------------------------# Begin Husky autogenerated content from setup-new-computer.sh   vX# --------------------------------------------------------------------# This loads nvm.sh and sets the correct PATH before running hookexport NVM_DIR="$HOME/.nvm"[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh"   # --------------------------------------------------------------------# End autogenerated content from setup-new-computer.sh   vX# --------------------------------------------------------------------
Ruby
brew install ruby
Google Cloud Components
brew install --cask google-cloud-sdksource"$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc"source"$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc"if [-e~/google-cloud-sdk ];thenecho"✔ ~/google-cloud-sdk exists. Skipping"elseecho"✔ Creating ~/google-cloud-sdk symlink"    ln -s"$(brew --prefix)/Caskroom/google-cloud-sdk"~/google-cloud-sdk&>/dev/null# make a convenience symlink at the install path for google-cloud-sdk when installed manuallyfigcloud components install app-engine-go --quietgcloud components install app-engine-python --quietgcloud components install app-engine-python-extras --quietgcloud components install kubectl --quietgcloud components install docker-credential-gcr --quiet

Applications

Firefox
brew install --cask firefox
Google Chrome
brew install --cask google-chrome
Rancher Desktop (Docker Desktop alternative)
brew install --cask rancher
Postman
brew install --cask postman

Optional IDEs and Tools

Visual Studio Code
brew install --cask visual-studio-code
Jetbrains Toolbox
brew install --cask jetbrains-toolbox
Pycharm
brew install --cask pycharm
Goland
brew install --cask goland
WebStorm
brew install --cask webstorm
Sublime Text
brew install --cask sublime-text
iTerm2
brew install --cask iterm2
Cursor
brew install --cask cursor

System Tweaks

General: Expand save and print panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -booltruedefaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -booltruedefaults write NSGlobalDomain PMPrintingExpandedStateForPrint -booltruedefaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -booltrue
General: Save to disk (not to iCloud) by default
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -boolfalse
General: Avoid creating .DS_Store files on network volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -booltrue
Typing: Disable smart quotes and dashes as they cause problems when typing code
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -boolfalsedefaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -boolfalse
Typing: Disable press-and-hold for keys in favor of key repeat
defaults write NSGlobalDomain ApplePressAndHoldEnabled -boolfalse
Finder: Show status bar and path bar
defaults write com.apple.finder ShowStatusBar -booltruedefaults write com.apple.finder ShowPathbar -booltrue
Finder: Disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -boolfalse
Finder: Show the ~/Library folder
chflags nohidden~/Library
Safari: Enable Safari’s Developer Settings
defaults write com.apple.Safari IncludeInternalDebugMenu -booltruedefaults write com.apple.Safari IncludeDevelopMenu -booltruedefaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -booltruedefaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -booltruedefaults write NSGlobalDomain WebKitDeveloperExtras -booltrue
Chrome: Disable the all too sensitive backswipe on Trackpads and Magic Mice
# Note: The chrome defaults can cause your Chrome browser to display a message stating# that Chrome is "Managed by your organization" when it isn't## To view policies that are affecting this message, view the following pages:# chrome://policy and chrome://management/## To quickly remove Chrome default overrides, run the following commands:# defaults delete com.google.Chrome# defaults delete com.google.Chrome.canary#defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -boolfalsedefaults write com.google.Chrome.canary AppleEnableSwipeNavigateWithScrolls -boolfalsedefaults write com.google.Chrome AppleEnableMouseSwipeNavigateWithScrolls -boolfalsedefaults write com.google.Chrome.canary AppleEnableMouseSwipeNavigateWithScrolls -boolfalse
Chrome: Use the system print dialog and expand dialog by default
# Note: The chrome defaults can cause your Chrome browser to display a message stating# that Chrome is "Managed by your organization" when it isn't## To view policies that are affecting this message, view the following pages:# chrome://policy and chrome://management/## To quickly remove Chrome default overrides, run the following commands:# defaults delete com.google.Chrome# defaults delete com.google.Chrome.canary#defaults write com.google.Chrome DisablePrintPreview -booltruedefaults write com.google.Chrome.canary DisablePrintPreview -booltruedefaults write com.google.Chrome PMPrintingExpandedStateForPrint2 -booltruedefaults write com.google.Chrome.canary PMPrintingExpandedStateForPrint2 -booltrue

Set up Git

Configure git to always ssh when dealing with https github repos
git config --global url."git@github.com:".insteadOf https://github.com/# you can remove this change by editing your ~/.gitconfig file
Set Git to store credentials in Keychain
git config --global credential.helper osxkeychain
Set git display name and email
if [-n"$(git config --global user.email)" ];thenecho"✔ Git email is set to$(git config --global user.email)"elseread -p'What is your Git email address?:' gitEmail  git config --global user.email"$gitEmail"fiif [-n"$(git config --global user.name)" ];thenecho"✔ Git display name is set to$(git config --global user.name)"elseread -p'What is your Git display name (Firstname Lastname)?:' gitName  git config --global user.name"$gitName"fi



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 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 20 (using NVM) for best compatibility with Angular and NX. You will likely want to change this.
  • To customize thewelcome logo and add a bit of style, I used the handyText 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 theLICENSE 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.

Testing in Virtual Machines

I recommend testing your script on a fresh Mac VM to make sure your changes will work properly. Installing on a clean Mac install will let you find problems you may not see if you run the script repeatedly on your own computer.

About

This script will help with the quick setup and installation of tools and applications for new developers at Vendasta.

Topics

Resources

License

Stars

Watchers

Forks

Contributors10

Languages


[8]ページ先頭

©2009-2025 Movatter.jp