-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup-a-new-machine.sh
executable file
·229 lines (152 loc) · 7.35 KB
/
setup-a-new-machine.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# copy paste this file in bit by bit.
# don't run it.
echo "do not run this script in one go. hit ctrl-c NOW"
read -n 1
################################################################################
### backup old machine's key items
mkdir -p ~/migration/home
cd ~/migration
# what is worth reinstalling?
brew leaves > brew-list.txt # all top-level brew installs
brew cask list > cask-list.txt
npm list -g --depth=0 > npm-g-list.txt
# then compare brew-list to what's in `brew.sh`
# comm <(sort brew-list.txt) <(sort brew.sh-cleaned-up)
# let's hold on to these
cp ~/.extra ~/migration/home
cp ~/.z ~/migration/home
cp -R ~/.ssh ~/migration/home
cp -R ~/.gnupg ~/migration/home
cp /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist ~/migration # wifi
cp ~/Library/Preferences/com.tinyspeck.slackmacgap.plist ~/migration
cp -R ~/Library/Services ~/migration # automator stuff
cp -R ~/Documents ~/migration
cp ~/.bash_history ~/migration # back it up for fun?
cp ~/.gitconfig.local ~/migration
# sublime text settings
cp "~/Library/Application Support/Sublime Text 3/Packages" ~/migration
# iTerm settings.
# Prefs, General, Use settings from Folder
# Finder settings and TotalFinder settings
# Not sure how to do this yet. Really want to.
# Timestats chrome extension stats
# chrome-extension://ejifodhjoeeenihgfpjijjmpomaphmah/options.html#_options
# gotta export into JSON through devtools:
# copy(JSON.stringify(localStorage, null, ' '))
# pbpaste > timestats-canary.json.txt
# Current Chrome tabs via OneTab
# software licenses like sublimetext
### end of old machine backup
################################################################################
################################################################################
### XCode Command Line Tools
# thx https://github.com/alrra/dotfiles/blob/ff123ca9b9b/os/os_x/installs/install_xcode.sh
if ! xcode-select --print-path &> /dev/null; then
# Prompt user to install the XCode Command Line Tools
xcode-select --install &> /dev/null
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Wait until the XCode Command Line Tools are installed
until xcode-select --print-path &> /dev/null; do
sleep 5
done
print_result $? 'Install XCode Command Line Tools'
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Point the `xcode-select` developer directory to
# the appropriate directory from within `Xcode.app`
# https://github.com/alrra/dotfiles/issues/13
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
print_result $? 'Make "xcode-select" developer directory point to Xcode'
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Prompt user to agree to the terms of the Xcode license
# https://github.com/alrra/dotfiles/issues/10
sudo xcodebuild -license
print_result $? 'Agree with the XCode Command Line Tools licence'
fi
###
################################################################################
################################################################################
### homebrew!
# (if your machine has /usr/local locked down (like google's), you can do this to place everything in ~/.homebrew
# mkdir $HOME/.homebrew && curl -L https://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C $HOME/.homebrew
# export PATH=$HOME/.homebrew/bin:$HOME/.homebrew/sbin:$PATH
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# install all the things
./brew.sh
./cask.sh
### end of homebrew
################################################################################
################################################################################
### install common things
###
# automatically add ssh keys to ssh-agent on boot (https://github.com/jirsbek/SSH-keys-in-macOS-Sierra-keychain)
cp ./prefs/ssh.add.a.plist ~/Library/LaunchAgents
# github.com/jamiew/git-friendly
# the `push` command which copies the github compare URL to my clipboard is heaven
bash < <( curl https://raw.github.com/jamiew/git-friendly/master/install.sh)
# Install rvm (https://rvm.io)
curl -L https://get.rvm.io | bash -s stable --ruby
# Install bundler (https://bundler.io)
gem install bundler
# Install nvm (https://github.com/creationix/nvm)
# curl https://raw.github.com/creationix/nvm/master/install.sh | sh
# Install n
curl -L https://git.io/n-install | bash
# Install node stuffs
npm install -g yarn
# github.com/rupa/z - oh how i love you
git clone https://github.com/rupa/z.git ~/code/z
# consider reusing your current .z file if possible. it's painful to rebuild :)
# z is hooked up in .bash_profile
# github.com/thebitguru/play-button-itunes-patch
# disable itunes opening on media keys
git clone https://github.com/thebitguru/play-button-itunes-patch ~/code/play-button-itunes-patch
# my magic photobooth symlink -> dropbox. I love it.
# + first move Photo Booth folder out of Pictures
# + then start Photo Booth. It'll ask where to put the library.
# + put it in Dropbox/public
# * Now… you can record photobooth videos quickly and they upload to dropbox DURING RECORDING
# * then you grab public URL and send off your video message in a heartbeat.
# for the c alias (syntax highlighted cat)
sudo easy_install Pygments
# change to bash 4 (installed by homebrew)
BASHPATH=$(brew --prefix)/bin/bash
#sudo echo $BASHPATH >> /etc/shells
sudo bash -c 'echo $(brew --prefix)/bin/bash >> /etc/shells'
chsh -s $BASHPATH # will set for current user only.
echo $BASH_VERSION # should be 4.x not the old 3.2.X
# Later, confirm iterm settings aren't conflicting.
# iterm with more margin! http://hackr.it/articles/prettier-gutter-in-iterm-2/
# (admittedly not as easy to maintain)
# setting up the sublime symlink
ln -sf "/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl" ~/bin/subl
# install Sublime Package Control
curl https://packagecontrol.io/Package%20Control.sublime-package ~/.config/sublime-text-3/Installed Packages
# copy Package Control settings
cp ./prefs/Package\ Control.sublime-settings ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User
# init Package Control (simply open Sublime)
subl
###
################################################################################
################################################################################
### remaining configuration
###
# go read mathias, paulmillr, gf3, alraa's dotfiles to see what's worth stealing.
# prezto and antigen communties also have great stuff
# github.com/sorin-ionescu/prezto/blob/master/modules/utility/init.zsh
# set up osx defaults
# maybe something else in here https://github.com/hjuutilainen/dotfiles/blob/master/bin/osx-user-defaults.sh
sh .osx
# setup and run Rescuetime!
###
################################################################################
################################################################################
### symlinks to link dotfiles into ~/
###
# move git credentials into ~/.gitconfig.local http://stackoverflow.com/a/13615531/89484
# now .gitconfig can be shared across all machines and only the .local changes
# symlink it up!
./symlink-setup.sh
# add manual symlink for .ssh/config and probably .config/fish
###
################################################################################
#