Skip to content

Commit 3dcaa61

Browse files
committed
12/17/2025
1 parent 2fe79cd commit 3dcaa61

11 files changed

Lines changed: 196 additions & 116 deletions

.10_macos.bash

Lines changed: 13 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -87,101 +87,6 @@ __homebrew_funcs() {
8787
__homebrew_funcs
8888

8989

90-
##### App installs #####
91-
92-
# Homebrew packages
93-
if command -v brew &> /dev/null; then
94-
# Apps (only install if shell is interactive, in case of admin password prompt)
95-
if [[ $- == *i* ]]; then
96-
for cask in $(
97-
echo "1password"
98-
#echo "discord"
99-
echo "firefox"
100-
echo "github"
101-
#echo "inkscape"
102-
echo "libreoffice"
103-
echo "linearmouse"
104-
echo "rectangle"
105-
#echo "signal"
106-
echo "spotify"
107-
#echo "steam"
108-
echo "visual-studio-code"
109-
echo "wine-stable"
110-
); do
111-
app_artifact=$(brew info --json=v2 --cask "${cask}" \
112-
| jq --raw-output ".casks[] | select(.token==\"${cask}\") | .artifacts[] | .app // empty | .[]" \
113-
| head -1)
114-
[[ -d "/Applications/${app_artifact}" ]] || echo brew install --cask "${cask}"
115-
done
116-
fi
117-
118-
# CLI tools
119-
command -v dive > /dev/null || brew install dive
120-
command -v gawk > /dev/null || brew install gawk
121-
command -v gdate > /dev/null || brew install coreutils
122-
command -v gh > /dev/null || brew install gh
123-
command -v gsed > /dev/null || brew install gnu-sed
124-
command -v jq > /dev/null || brew install jq
125-
command -v rename > /dev/null || brew install rename
126-
command -v tree > /dev/null || brew install tree
127-
command -v watch > /dev/null || brew install watch
128-
command -v wget > /dev/null || brew install wget
129-
130-
if ! command -v hstr &> /dev/null; then
131-
brew install hstr
132-
hstr --show-configuration >> ~/.bashrc
133-
fi
134-
fi
135-
136-
# App store applications
137-
if command -v brew &> /dev/null; then
138-
if ! command -v mas &> /dev/null; then
139-
brew install mas
140-
# Installed applications aren't enumerated immediately, `mas list` may return nothing
141-
else
142-
# If there are no installed applications, it could be because a newer OS version needs a newer version of 'mas'
143-
mas list | grep -Eq '^[0-9]+ ' || brew upgrade mas
144-
fi
145-
fi
146-
if command -v mas &> /dev/null; then
147-
mas_list=$(mas list)
148-
for app_id in $(
149-
# ----- Applications -----
150-
# TODO: Keka (paid)
151-
# Kindle
152-
echo "302584613"
153-
# TODO: LibreOffice (paid)
154-
# TODO: Maccy (paid)
155-
# Menu World Time
156-
# echo "1446377255"
157-
# NordVPN
158-
echo "905953485"
159-
# Telegram
160-
# echo "747648890"
161-
# ----- Safari Extensions -----
162-
# 1Password for Safari
163-
echo "1569813296"
164-
# Grammarly for Safari
165-
echo "1462114288"
166-
); do
167-
echo "${mas_list}" | grep -Eq "^${app_id} " || mas install "${app_id}"
168-
done
169-
fi
170-
171-
# macOS DNS flush
172-
flush() {
173-
sudo dscacheutil -flushcache
174-
sudo killall -HUP mDNSResponder
175-
}
176-
177-
# macOS DHCP renew
178-
# @link https://apple.stackexchange.com/a/17429
179-
renew() {
180-
sudo ipconfig set en0 BOOTP
181-
sudo ipconfig set en0 DHCP
182-
}
183-
184-
18590
##### Aliases #####
18691

18792
# Prefer GNU's coreutils binaries
@@ -201,6 +106,19 @@ alias dt="cd ~/Desktop"
201106
alias lsports="sudo lsof -iTCP -sTCP:LISTEN -n -P"
202107
alias lsp=lsports
203108

109+
# macOS DNS flush
110+
flush() {
111+
sudo dscacheutil -flushcache
112+
sudo killall -HUP mDNSResponder
113+
}
114+
115+
# macOS DHCP renew
116+
# @link https://apple.stackexchange.com/a/17429
117+
renew() {
118+
sudo ipconfig set en0 BOOTP
119+
sudo ipconfig set en0 DHCP
120+
}
121+
204122
# macOS has no `realpath` by default, so emulate it
205123
# @link https://stackoverflow.com/a/18443300
206124
command -v realpath > /dev/null || realpath() {

.20_claude.bash

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
__claude_lazy_install() {
2+
if ! command -v claude &> /dev/null; then
3+
claude() {
4+
curl -fsSL https://claude.ai/install.sh | bash
5+
unset -f "$0"
6+
$0 "$@"
7+
}
8+
fi
9+
}
10+
__claude_lazy_install

.20_docker.bash

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@ export BUILDKIT_PROGRESS=plain
22
export PROGRESS_NO_TRUNC=1
33

44

5+
__docker_lazy_install() {
6+
if ! command -v dive &> /dev/null && command -v brew &> /dev/null; then
7+
dive() {
8+
brew install dive
9+
unset -f "$0"
10+
$0 "$@"
11+
}
12+
fi
13+
}
14+
__docker_lazy_install
15+
16+
517
__docker_funcs() {
618
# Auto/lazy-start Docker if it's not running
719
if command -v docker &> /dev/null; then

.20_git.bash

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
# Don't use the git from macOS, use the Homebrew version instead
2-
if command -v brew &> /dev/null && [[ ! -f "$(brew --prefix)/bin/git" ]]; then
3-
brew install git
4-
brew link --overwrite git
5-
fi
6-
71
if ! command -v git &> /dev/null; then
82
return 0
93
fi

.20_kubernetes.bash

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
__kube_lazy_install() {
2+
if ! command -v k9s &> /dev/null && command -v brew &> /dev/null; then
3+
k9s() {
4+
brew install k9s
5+
unset -f "$0"
6+
$0 "$@"
7+
}
8+
fi
9+
if ! command -v kubectl &> /dev/null && command -v brew &> /dev/null; then
10+
kubectl() {
11+
brew install kubectl
12+
unset -f "$0"
13+
$0 "$@"
14+
}
15+
fi
16+
}
17+
__kube_lazy_install
18+
19+
120
__kube_minikube() {
221
kminikube() {
322
minikube update-context || kubectl config use-context minikube

.20_temporal.bash

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Reset back to non-beta functionality
2-
if command -v tctl &> /dev/null; then
3-
tctl config set version current
4-
fi
2+
#if command -v tctl &> /dev/null; then
3+
# tctl config set version current
4+
#fi
55

66
if [[ -d "${HOME}/.temporalio/bin" ]]; then
77
export PATH="${PATH}:${HOME}/.temporalio/bin"
@@ -30,6 +30,25 @@ __temporal_completions() {
3030
__temporal_completions
3131

3232

33+
__temporal_lazy_install() {
34+
if ! command -v tctl &> /dev/null && command -v brew &> /dev/null; then
35+
tctl() {
36+
brew install tctl
37+
unset -f "$0"
38+
$0 "$@"
39+
}
40+
fi
41+
if ! command -v temporal &> /dev/null && command -v brew &> /dev/null; then
42+
temporal() {
43+
brew install temporal
44+
unset -f "$0"
45+
$0 "$@"
46+
}
47+
fi
48+
}
49+
__temporal_lazy_install
50+
51+
3352
__tctl_funcs() {
3453
__tctl_rows_to_table() {
3554
local columns=$1

.githooks/post-merge

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@ set -euo pipefail
1111
# squash merge. This hook cannot affect the outcome of git merge and is not executed, if the merge
1212
# failed due to conflicts.
1313

14-
echo "↓↓↓↓↓ emmercm/dotfiles post-merge ↓↓↓↓↓"
14+
echo -e "\033[47m↓↓↓↓↓ emmercm/dotfiles post-merge ↓↓↓↓↓\033[0m"
1515

1616

17-
echo "Running install.sh"
17+
echo -e "\033[47m>>>>> Running install.sh >>>>>\033[0m"
1818
./install.sh
1919

20-
echo "Running settings.sh"
20+
echo -e "\033[47m>>>>> Running packages.sh >>>>>\033[0m"
21+
./packages.sh
22+
23+
echo -e "\033[47m>>>>> Running settings.sh >>>>>\033[0m"
2124
./settings.sh
2225

2326

24-
echo "↑↑↑↑↑ emmercm/dotfiles post-merge ↑↑↑↑↑"
27+
echo -e "\033[47m↑↑↑↑↑ emmercm/dotfiles post-merge ↑↑↑↑↑\033[0m"

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@
22

33
A collection of personal dotfiles.
44

5-
## Installing
5+
## Installing dotfiles to `$HOME`
66

77
`git clone` this repository and then run [`./install.sh`](./install.sh).
88

99
All dotfiles are symlinked to the user's home directory to keep them up to date with this repo. Files that would be overwritten are backed-up first.
1010

11+
## Other setup
12+
13+
These files are not installed into `$HOME` and should be run as necessary:
14+
15+
- [`./packages.sh`](./packages.sh) installs commonly used tools and applications from package managers
16+
- [`./settings.sh`](./settings.sh) updates OS settings to preferred defaults
17+
1118
## Shells
1219

1320
The following shells are supported by these dotfiles:

install.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function link() {
3030

3131
# Assume symlinks are ok
3232
if [[ -h "${link}" ]]; then
33-
echo "Ignoring: ${link}"
33+
echo -e "\033[93mIgnoring:\033[0m ${link}"
3434
continue
3535
fi
3636

@@ -43,12 +43,13 @@ function link() {
4343
fi
4444

4545
# Symlink the file
46-
echo "Linking: ${link} -> ${file}"
46+
echo -e "\033[92mLinking:\033[0m ${link} -> ${file}"
4747
ln -s "${file}" "${link}"
4848
done <<< "$(find "$1" -maxdepth 1 -name "$2" ! -name ".git" ! -name ".github" ! -name ".gitignore")"
4949

5050
# Delete broken symlinks
5151
while read -r file; do
52+
echo -e "\033[91mDeleting:\033[0m ${file}"
5253
rm -f "${file}"
5354
done <<< "$(find "${HOME}" -maxdepth 1 -type l ! -exec test -e {} \; -print)"
5455
}

packages.sh

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
if [[ "${OSTYPE:-}" == "darwin"* ]]; then
5+
# Ensure https://brew.sh/ is installed and loaded
6+
if ! command -v brew &> /dev/null; then
7+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
8+
fi
9+
if [[ ! -x "$(command -v brew)" && -f /opt/homebrew/bin/brew ]]; then
10+
eval "$(/opt/homebrew/bin/brew shellenv)"
11+
fi
12+
13+
brew update
14+
brew upgrade
15+
16+
# Install Homebrew formulas
17+
command -v gawk > /dev/null || brew install gawk
18+
command -v gdate > /dev/null || brew install coreutils
19+
command -v gh > /dev/null || brew install gh
20+
if [[ ! -f "$(brew --prefix)/bin/git" ]]; then
21+
# Overwrite the very old git that ships with macOS
22+
brew install git
23+
brew link --overwrite git
24+
fi
25+
command -v gsed > /dev/null || brew install gnu-sed
26+
if ! command -v hstr &> /dev/null; then
27+
brew install hstr
28+
hstr --show-configuration >> ~/.bashrc
29+
fi
30+
command -v jq > /dev/null || brew install jq
31+
command -v rename > /dev/null || brew install rename
32+
command -v tree > /dev/null || brew install tree
33+
command -v watch > /dev/null || brew install watch
34+
command -v wget > /dev/null || brew install wget
35+
36+
# Install Homebrew casks (only install if shell is interactive, in case of admin password prompt)
37+
if ! sudo -n true &> /dev/null; then
38+
echo -e "\033[1;33mWARN:\033[0m you may be asked for your password to run 'brew install --cask'\n"
39+
fi
40+
for cask in $(
41+
echo "1password"
42+
echo "charmstone"
43+
#echo "discord"
44+
echo "docker-desktop"
45+
echo "firefox"
46+
echo "github"
47+
echo "hiddenbar"
48+
#echo "inkscape"
49+
echo "keka"
50+
echo "libreoffice"
51+
echo "linearmouse"
52+
#echo "maccy"
53+
#echo "nordvpn"
54+
#echo "postman"
55+
echo "rectangle"
56+
#echo "sdformatter"
57+
#echo "signal"
58+
#echo "slack"
59+
echo "spotify"
60+
#echo "steam"
61+
#echo "telegram"
62+
echo "visual-studio-code"
63+
echo "wine-stable"
64+
); do
65+
printf "Checking for cask '${cask}' ... "
66+
missing_apps=$(brew info --json=v2 --cask "${cask}" \
67+
| jq --raw-output ".casks[] | select(.token==\"${cask}\") | .artifacts[] | .app // empty | .[]" \
68+
| xargs -I {} sh -c 'test ! -d "/Applications/{}" && echo "{}"' || true)
69+
if [[ -n "${missing_apps}" ]]; then
70+
echo "missing, installing ..."
71+
brew install --cask "${cask}"
72+
else
73+
echo "found"
74+
fi
75+
done
76+
77+
# Install App store applications
78+
if ! command -v mas &> /dev/null; then
79+
brew install mas
80+
# WARN: installed applications aren't enumerated immediately, `mas list` may return nothing
81+
else
82+
# If there are no installed applications, it could be because a newer OS version needs a newer version of 'mas'
83+
mas list | grep -Eq '^[0-9]+ ' || brew upgrade mas
84+
fi
85+
mas_list=$(mas list)
86+
for app_id in $(
87+
# ----- Applications -----
88+
# Kindle
89+
echo "302584613"
90+
# Menu World Time
91+
# echo "1446377255"
92+
# ----- Safari Extensions -----
93+
# 1Password for Safari
94+
echo "1569813296"
95+
# Grammarly for Safari
96+
echo "1462114288"
97+
); do
98+
echo "${mas_list}" | grep -Eq "^${app_id} " || mas install "${app_id}"
99+
done
100+
fi

0 commit comments

Comments
 (0)