Skip to content

Instantly share code, notes, and snippets.

@d3zza
Last active December 4, 2019 05:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d3zza/494c799d67c94a3815944e7e84908b1a to your computer and use it in GitHub Desktop.
Save d3zza/494c799d67c94a3815944e7e84908b1a to your computer and use it in GitHub Desktop.
2019-mac-setup
install iterm2, vscode
#zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
#show hidden files - select MacHD and press command shift dot
#install homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
#install nvm
brew install nvm
#install yarn
brew install yarn
#add to ~/.zshrc
# exec NVM in every session
export NVM_DIR="$HOME/.nvm"
. "$(brew --prefix nvm)/nvm.sh"
# make nvm use version in .nvmrc automatically
autoload -U add-zsh-hook
load-nvmrc() {
local node_version="$(nvm version)"
local nvmrc_path="$(nvm_find_nvmrc)"
if [ -n "$nvmrc_path" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
if [ "$nvmrc_node_version" = "N/A" ]; then
nvm install
elif [ "$nvmrc_node_version" != "$node_version" ]; then
nvm use
fi
elif [ "$node_version" != "$(nvm version default)" ]; then
echo "Reverting to nvm default version"
nvm use default
fi
}
add-zsh-hook chpwd load-nvmrc
load-nvmrc
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
#sync vs code settings, install settings sync extension
#download settings: shift + alt + d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment