-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·75 lines (61 loc) · 1.95 KB
/
install.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
#!/bin/sh
echo "Setting up your Mac..."
# Paremeters
while getopts ":n:" opt; do
case $opt in
n)
COMPUTER_NAME=${OPTARG};;
esac
done
# Set computer name
# https://ilostmynotes.blogspot.com/2012/03/computername-vs-localhostname-vs.html
if [[ -z ${COMPUTER_NAME} ]] ; then
echo "Computer name not set"
else
echo "Computer name set to ${COMPUTER_NAME}"
sudo scutil --set ComputerName "${COMPUTER_NAME}"
sudo scutil --set HostName "${COMPUTER_NAME}"
sudo scutil --set LocalHostName "${COMPUTER_NAME}"
fi
# Disable natural scrolling
defaults write NSGlobalDomain com.apple.swipescrolldirection -bool FALSE
# Show hidden file
defaults write com.apple.Finder AppleShowAllFiles true
# Restart Finder
killall Finder
# Check for zrezto and install if we don't have it
if [ ! -d "${ZDOTDIR:-$HOME}/.zprezto" ]; then
echo "Installing Prezto"
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
# setopt EXTENDED_GLOB
# for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
# ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
# done
chsh -s /bin/zsh
fi
# Check for Homebrew and install if we don't have it
if test ! $(which brew); then
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
# Update Homebrew recipes
echo "Installing stuff via Homebrew"
brew update
brew bundle
# Restore dotfiles
echo "Updating preferences using Mackup"
if [[ -f "~/.mackup" ]]; then
echo "Mackup file already exists, aborting"
else
ln -s $(pwd)/dotfiles/.mackup ~/.mackup
ln -s $(pwd)/dotfiles/.mackup.cfg ~/.mackup.cfg
mackup restore
fi
# Set macOS preferences
echo "Setting preferences"
source setup/settings.sh
source setup/preferences.sh
source setup/nvram.sh
# macOS security 101
# Definitely check out in more details the README
# https://github.com/drduh/macOS-Security-and-Privacy-Guide
# https://blog.bejarano.io/hardening-macos.html