-
Notifications
You must be signed in to change notification settings - Fork 0
/
dotfiles.sh
118 lines (70 loc) · 2.39 KB
/
dotfiles.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
#!/bin/sh
# Check if System Integrity Protection is enabled
csrutil status &&
# Create dotfiles
touch ~/.bash_profile &&
touch ~/.profile &&
touch ~/.bashrc &&
touch ~/.aliases &&
# Modify ~/.bash_profile
cat > ~/.bash_profile <<- 'EOF'
: '
if [ -f ~/.profile ] ; then
. ~/.profile
fi
# If the shell is interactive, source ~/.bashrc
case "$-" in *i*) if [ -r ~/.bashrc ]; then . ~/.bashrc; fi;; esac
'
EOF &&
# Modify ~/.bashrc
echo 'source ~/.aliases' > ~/.bashrc &&
# Modify ~/.aliases
nano ~/.aliases
: 'replace contents of .aliases with shortcuts for frequently used terminal commands'
# Create and modify files for Zshell integration
touch ~/.zprofile &&
echo '[[ -e ~/.profile ]] && emulate sh -c "source ~/.profile"' > ~/.zprofile &&
# Modify ~/.zshrc
echo 'source ~/.aliases' > ~/.zshrc &&
# Install Xcode Command Line Tools (for GCC which is a Homebrew pre-requisite)
sudo xcodebuild -license accept &&
xcode-select --install
# Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Modify PATH variable to prioritize Homebrew
echo export PATH='/usr/local/bin:$PATH' >> ~/.profile
# Test PATH variable modification
# Should look like /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
source ~/.profile
echo $PATH
# Python (via Miniconda3)
# Download latest version of Miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O ~/Documents/miniconda.sh &&
# Verify installer hashes
shasum -a 256 /Users/jt/Documents/miniconda.sh
# Install Miniconda3
bash ~/Documents/miniconda.sh -p $HOME/miniconda
# For a zsh (macOS Catalina default shell) compatible dotfiles replace the second line with
# source <path to conda>/bin/activate
# conda init zsh
# Ruby
# Install Ruby
brew install rbenv ruby-build
# Modify ~/.profile to prioritize rbenv
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.profile
source ~/.profile
# Test rbenv install
type rbenv
# Complete Ruby Installation (latest version)
LATEST_RUBY_VERSION=$(rbenv install -l | grep -v - | tail -1)
rbenv install $LATEST_RUBY_VERSION
rbenv global $LATEST_RUBY_VERSION
# Test Ruby Installation
ruby -v
gem -v
# Disable local download for documentation of each gem
echo 'gem: --no-document' > ~/.gemrc
# Install Jekyll and Bundler
gem install jekyll bundler
# Rehash Ruby (necessary after installing bundler)
rbenv rehash