Skip to content

Instantly share code, notes, and snippets.

@byurhannurula
Last active August 29, 2020 07:27
Show Gist options
  • Save byurhannurula/3b84011319fd94f42a2b70714f07c74c to your computer and use it in GitHub Desktop.
Save byurhannurula/3b84011319fd94f42a2b70714f07c74c to your computer and use it in GitHub Desktop.
#!/bin/bash
set -euo pipefail
# Display message 'Setting up your Mac...'
echo "Setting up your Mac..."
sudo -v
# Installing XCodes cli tools...
if type xcode-select >&- && xpath=$( xcode-select --print-path ) &&
test -d "${xpath}" && test -x "${xpath}" ; then
echo "Xcode already installed. Skipping."
else
echo "Installing Xcode…"
xcode-select --install
echo "Success: Xcode installed!"
fi
if [ ! -d "$HOME/.bin/" ]; then
mkdir "$HOME/.bin"
fi
# NVM - Installation
if [ -x nvm ]; then
echo "Installing NVM…"
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
echo "Success: NVM installed!"
echo "Installing Node 8.15.0"
nvm install 8.15.0
echo "Installing latest Node…"
nvm install node
nvm use node
nvm run node --version
nodev=$(node -v)
echo "Using Node $nodev!"
echo "Setting alias for default node $node!"
nvm alias default node
else
echo "NVM/Node already installed. Skipping."
fi
# Homebrew - Installation
echo "Installing Homebrew"
if test ! $(which brew); then
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
# Install Homebrew Packages
cd ~
echo "Installing Homebrew packages"
homebrew_packages=(
"git"
"node"
"yarn"
"zsh"
"zsh-completions"
"zsh-autosuggestions"
"zsh-syntax-highlighting"
"history-substring-search"
)
for homebrew_package in "${homebrew_packages[@]}"; do
brew install "$homebrew_package"
done
# Install Casks
# echo "Installing Homebrew cask packages"
homebrew_cask_packages=(
"google-chrome"
"iterm2"
"notion"
"spotify"
"discord"
"telegram"
"visual-studio-code"
)
# for homebrew_cask_package in "${homebrew_cask_packages[@]}"; do
# brew cask install "$homebrew_cask_package"
# done
# Install NPM packages
echo "Installing NPM packages"
npm_packages=(
"gatsby-cli"
"gulp"
"vercel"
"cordova"
"expo-cli"
"browserify"
"npm-install-peers"
)
for npm_package in "${npm_packages[@]}"; do
npm install -g "$npm_package"
done
# Homebrew cleaning...
echo "Cleaning up Homebrew files…"
brew cleanup 2> /dev/null
# configure git
git config --global user.name "Byurhan Beyzat"
git config --global user.email "imbyurhan@gmail.com"
# Generate SSH key
echo "Generating SSH keys"
ssh-keygen -t rsa
echo "Copied SSH key to clipboard - You can now add it to Github"
pbcopy < ~/.ssh/id_rsa.pub
echo "SSh Agent setup"
eval $(ssh-agent)
ssh-add ~/.ssh/id_rsa
# zsh and oh-my-zsh
echo "Adding ZSH"
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# zsh configuration
touch ~/.my-zshrc
curl https://raw.githubusercontent.com/byurhanbeyzat/dotfiles/master/zsh-shell/.zshrc >> ~/.my-zshrc
# zsh plugins
echo "source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ~/.my-zshrc
echo "source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.my-zshrc
echo "source /usr/local/share/zsh-history-substring-search/zsh-history-substring-search.zsh" >> ~/.my-zshrc
# Copy custom theme from github repo
curl https://raw.githubusercontent.com/byurhanbeyzat/dotfiles/master/zsh-shell/byurhanbeyzat.zsh-theme >> ~/oh-my-zsh/custom/themes/byurhanbeyzat.zsh-theme
# Install second theme
git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
# add our zshrc config to the main zshrc config
echo ". ~/.my-zshrc" >> "$HOME/.zshrc"
# finally changing default shell to zsh (probably not needed with catalina?)
chsh -s /bin/zsh
echo "Current shell: $SHELL"
# Complete
echo "Installation Complete"
echo "Ready to GO! 🚀"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment