Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 131 lines (100 sloc) 2.88 KB
#!/usr/bin/env bash
set -e
# macOS development setup
#
# Run this script to install and setup basic tools on a machine.
# Or run it to update current setup to latest changes.
# Steal the bits you like and adjust it to your needs.
# Run in dotfiles folder
cd -P "$(dirname "${BASH_SOURCE}")"
# Become super user before starting work
sudo -v
printf "\nSetting up system with latest toys ...\n\n"
# Enable italic support
tic xterm-256color-italic.terminfo
# Create folders
mkdir -p \
~/bin \
~/projects \
~/.lein
# Create Symlinks
link_to() {
if [ ! -e "$2" ]; then
if [ ! -e "$1" ]; then
printf "\nWARNING: cannot link $1 because it does not exist\n"
else
mkdir -p "$(dirname "$2")"
ln -s "$1" "$2"
printf "\nLinked $2"
fi
fi
}
link_dotfile() {
link_to $(pwd)/$1 ~/.$1
}
link_dotfile inputrc
link_dotfile bashrc
link_dotfile bash_profile
link_dotfile gitconfig
link_dotfile vimrc
link_dotfile psqlrc
link_dotfile sqliterc
link_to $(pwd)/nvim-client ~/bin/nvim-client
link_to ~/Dropbox/more/ssh/config ~/.ssh/config
link_to $(pwd)/profiles.clj ~/.lein/profiles.clj
link_to $(pwd)/deps.edn ~/.clojure/deps.edn
link_to "$(pwd)/Terminal Edit.app" "/Applications/Terminal Edit.app"
printf "\nUpdating macOS\n"
sudo softwareupdate -i -a
if [[ "$(xcode-select -p)" == "" ]]; then
printf "\nInstalling Xcode\n"
xcode-select --install
fi
# Brew
if ! command -v brew > /dev/null 2>&1; then
printf "\nInstalling Brew\n"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew analytics off
fi
printf "\nUpdating Brew\n"
brew update
brew upgrade
printf "\nInstalling Brew taps\n"
comm -23 <(sort brew.txt) <(brew leaves) | xargs brew install
# Update brew.txt
brew leaves > brew.txt
printf "\nInstalling Cask taps\n"
comm -23 <(sort cask.txt) <(brew cask ls) | xargs brew cask install
# Update brew.txt
brew cask ls > cask.txt
brew cleanup
# FZF - Install key bindings and fuzzy completion
$(brew --prefix)/opt/fzf/install \
--no-zsh \
--no-update-rc \
--key-bindings \
--completion
# NPM packages
printf "\nUpdating npm packages\n"
cat npm.txt | xargs npm i -g
ls /usr/local/lib/node_modules > npm.txt
# Neovim
pip install --upgrade pip
pip3 install --upgrade pip
pip3 install --user --upgrade neovim
pip install --user --upgrade neovim
test -d ~/.vim || mkdir ~/.vim
if [ ! -d ~/.config/nvim ]; then
ln -s ~/.vim ~/.config/nvim
ln -s ~/.vimrc ~/.config/nvim/init.vim
ln -s /usr/share/vim/vim74/spell/ ~/.config/nvim/
printf "\nLinked Neovim config"
fi
## vim-plug
if [ ! -e ~/.config/nvim/autoload/plug.vim ]; then
printf "\nInstalling vim-plug"
curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi
nvim +PlugInstall +PlugUpgrade +PlugUpdate +PlugClean! +UpdateRemotePlugins +qall
printf "\n\n\nAll good. Enjoy your day human."
You can’t perform that action at this time.