-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_darwin.sh
executable file
·86 lines (72 loc) · 2.35 KB
/
setup_darwin.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
function init() {
# install brew
if type brew >/dev/null 2>&1; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
# install basic packages
brew install \
git curl wget jq tree \
fish peco ghq stow ripgrep mas \
neovim pyenv nodenv node-build rbenv ruby-build go \
tmux reattach-to-user-namespace
# install fish plugins with fisher
curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish |
source && fisher install jorgebucaran/fisher
# set defualt shell to fish
echo $(which fish) | sudo tee -a /etc/shell
chsh -s $(which fish)
# python
PYTHON_LATEST=$(pyenv install -l | grep -E '^\s*\d+\.\d+\.\d+$' | tail -n 1 | xargs echo)
pyenv install $PYTHON_LATEST
pyenv global $PYTHON_LATEST
python -m pip install -U pip pynim neovim
# node
NODE_LATEST=$(nodenv install -l | grep -E '^\s*\d+\.\d+\.\d+$' | tail -n 1 | xargs echo)
nodenv install $NODE_LATEST
nodenv global $NODE_LATEST
npm install -g neovim
# ruby
RUBY_LATEST=$(rbenv install -l | grep -E '^\s*\d+\.\d+\.\d+$' | tail -n 1 | xargs echo)
rbenv install $RUBY_LATEST
rbenv global $RUBY_LATEST
npm install -g neovim
# create directories
mkdir -p ~/repos/{bin,pkg,src} # golang / ghq
mkdir -p ~/.config/karabiner # karabiner
mkdir -p ~/.local/bin # binaries
}
function deploy() {
[ -f ~/.config/functions/fish_prompt.fish ] &&
mv ~/.config/fish/functions/fish_prompt.fish ~/.config/fish/functions/fish_prompt.fish.bak
[ -f ~/.config/karabiner/karabiner.json ] &&
mv -f ~/.config/karabiner/karabiner.json ~/.config/karabiner/karabiner.json.bak
# deploy .files with stow
_stow -t ~/.config/fish -S fish
_stow -t ~/.config/nvim -S neovim
_stow -t ~/.config/karabiner -S karabiner
_stow -t ~/.config/iterm2 -S iterm
_stow -t ~/ -S git
_stow -t ~/ -S idea
_stow -t ~/ -S others
}
function clean() {
# clean .files with stow
_stow -t ~/.config/fish -D fish
_stow -t ~/.config/nvim -D neovim
_stow -t ~/.config/karabiner -D karabiner
_stow -t ~/.config/iterm2 -D iterm
_stow -t ~/ -D git
_stow -t ~/ -D idea
_stow -t ~/ -D others
}
function _stow() {
stow --ignore ".DS_Store" -v $@
}
if [ "$1" = "init" ]; then
init
elif [ "$1" = "deploy" ]; then
deploy "$2"
elif [ "$1" = "clean" ]; then
clean
fi