-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_mac.sh
66 lines (54 loc) · 2.17 KB
/
install_mac.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
#!/bin/bash
set -eu
DOTFILES_PARENT_DIR="${HOME}/dev/src/github.com/gtnao"
DOTFILES_DIR="${DOTFILES_PARENT_DIR}/dotfiles"
# Check if Homebrew is installed
if ! command -v brew &>/dev/null; then
echo "Homebrew is not installed. Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
echo "Homebrew is already installed."
fi
# Add Homebrew initialization to .zprofile if not already added
if ! grep -q '/opt/homebrew/bin/brew shellenv' "$HOME/.zprofile"; then
echo "Adding Homebrew initialization to .zprofile..."
echo "eval \"$(/opt/homebrew/bin/brew shellenv)\"" >>"$HOME/.zprofile"
eval "$(/opt/homebrew/bin/brew shellenv)"
else
echo "Homebrew initialization is already added to .zprofile."
fi
# Download dotfiles repository
mkdir -p "${DOTFILES_PARENT_DIR}"
if [ ! -d "${DOTFILES_DIR}" ]; then
git clone https://github.com/gtnao/dotfiles.git "${DOTFILES_DIR}"
ln -sfn "${DOTFILES_DIR}/.gitconfig" ~/.gitconfig
fi
cd "${DOTFILES_DIR}"
git remote set-url origin [email protected]:gtnao/dotfiles.git
# Install by Brewfile
brew bundle install --file=Brewfile
# Install nodejs
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
asdf install nodejs 20.11.1
asdf global nodejs 20.11.1
# Generate ssh key
if [ ! -f "${HOME}/.ssh/id_rsa" ]; then
ssh-keygen -t rsa -b 2048 -f "${HOME}/.ssh/id_rsa" -N ""
chmod 0600 "${HOME}/.ssh/id_rsa"
chmod 0644 "${HOME}/.ssh/id_rsa.pub"
fi
# deploy
./deploy.sh
# nvim setup
# nvim --headless "+Lazy! sync" +qa
# defaults
defaults write NSGlobalDomain com.apple.swipescrolldirection -bool true
defaults write NSGlobalDomain KeyRepeat -int 2
defaults write NSGlobalDomain InitialKeyRepeat -int 15
defaults write com.apple.finder AppleShowAllFiles -bool true
defaults write com.apple.dock orientation -string left
defaults write com.apple.dock autohide -bool true
defaults write com.apple.dock autohide-delay -float 0
defaults write com.apple.dock autohide-time-modifier -float 0.5
defaults write com.apple.AppleMultitouchTrackpad Clicking -bool false
echo "Please check your SSH public key with 'cat ~/.ssh/id_rsa.pub' and register it to your GitHub account if you haven't done so already."