@@ -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"
201106alias lsports=" sudo lsof -iTCP -sTCP:LISTEN -n -P"
202107alias 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
206124command -v realpath > /dev/null || realpath () {
0 commit comments