Skip to content

Commit 227a3ec

Browse files
fix(setup): update deprecated packages and improve idempotency
- Fix caskinstall typo to installcask - Remove deprecated taps (homebrew/cask, cask-versions, cask-fonts) - Remove obsolete brew options (--with-iri, --with-ssl, etc) - Rename htop-osx to htop - Use mongodb/brew tap for mongodb-community - Install howdoi via pip3 instead of deprecated brew formula - Use installcask for visual-studio-code - Remove duplicate node and sublime-text installs - Add directory checks before git clone operations - Replace hardcoded /Users/$(whoami) with $HOME - Fix font curl commands with -fLo flags for redirects - Remove deprecated josegonzalez/homebrew-php tap - Remove unclear set -P command
1 parent 9a15e2b commit 227a3ec

File tree

1 file changed

+36
-39
lines changed

1 file changed

+36
-39
lines changed

setup/setup_mac.sh

Lines changed: 36 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ brew upgrade
2929
brew install coreutils
3030
echo "Don’t forget to add $(brew --prefix coreutils)/libexec/gnubin to \$PATH."
3131

32-
brew tap homebrew/cask
33-
3432
# Utility function to install cask formulas
3533
function installcask() {
3634
if brew info --cask "${@}" | grep "Not installed" > /dev/null; then
@@ -40,9 +38,6 @@ function installcask() {
4038
fi
4139
}
4240

43-
# Tap all the cask verision from homebrew
44-
brew tap homebrew/cask-versions
45-
4641
# Install GNU `find`, `locate`, `updatedb`, and `xargs`, g-prefixed
4742
brew install findutils
4843

@@ -51,26 +46,23 @@ brew install bash
5146
brew install zsh zsh-completions
5247
brew install shellcheck
5348

54-
# Install wget with IRI support
55-
brew install wget --with-iri
56-
brew install curl --with-ssl --with-ssh
57-
# Install GNU `sed`, overwriting the built-in `sed`.
58-
brew install gnu-sed --with-default-names
59-
60-
# Install more recent versions of some OS X tools
61-
brew tap josegonzalez/homebrew-php
49+
# Install wget and curl
50+
brew install wget
51+
brew install curl
52+
# Install GNU `sed`
53+
brew install gnu-sed
6254

6355
# Use `assume` for cloud tasks
6456
brew tap common-fate/granted
6557
brew install chamber # CLI for managing secrets through AWS SSM Parameter Store
6658

6759
# Install everything else
68-
caskinstall sublime-text
69-
brew install visual-studio-code
60+
installcask sublime-text
61+
installcask visual-studio-code
7062
brew install openssl
7163
brew install ack
7264
brew install git git-extras hub git-ftp git-crypt
73-
brew install rename htop-osx tree ngrep mtr nmap
65+
brew install rename htop tree ngrep mtr nmap
7466
brew install autojump
7567
brew install legit # http://www.git-legit.org/
7668
# brew install Zopfli # https://code.google.com/p/zopfli/
@@ -149,8 +141,6 @@ brew install gdal
149141
brew install postgis
150142

151143
# Fonts
152-
brew tap homebrew/cask-fonts
153-
154144
installcask font-source-code-pro
155145

156146
# Python packages (pip is included with Python 3 from brew)
@@ -161,7 +151,8 @@ pip3 install -r requirements.pip
161151
################################################################################
162152

163153
brew install mysql
164-
brew install mongo
154+
brew tap mongodb/brew
155+
brew install mongodb-community
165156
brew install redis
166157
brew install elasticsearch
167158

@@ -191,12 +182,10 @@ brew install datawire/blackbird/telepresence2
191182

192183
brew install diff-so-fancy
193184
brew link xz && brew install weechat
194-
installcask sublime-text
195185
brew install tmux
196186
brew install cookiecutter
197187

198188
# Some frontend stuff
199-
brew install node
200189
npm i -g postcss-cli
201190
npm i -g autoprefixer
202191

@@ -214,7 +203,7 @@ installcask slack
214203
# brew install lastpass-cli --with-pinentry
215204
brew install bitwarden
216205
# Install howdoi CLI tool
217-
brew install https://raw.github.com/gleitz/howdoi/master/howdoi.rb
206+
pip3 install howdoi
218207
brew install tor
219208
brew install spotify
220209

@@ -258,29 +247,37 @@ install_oh_my_zsh
258247
# Zsh #
259248
###############################################################################
260249

261-
set -P
262250
# Install Zsh settings
263251
ln -sf "$PWD"/zsh/themes/curiouslearner.zsh-theme "$HOME"/.oh-my-zsh/themes
252+
264253
# Zsh Syntax highlighting
265-
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "${ZSH_CUSTOM:-~/.oh-my-zsh/custom}"/plugins/zsh-syntax-highlighting
254+
ZSH_CUSTOM="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}"
255+
if [[ ! -d "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting" ]]; then
256+
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting"
257+
fi
266258

267-
## Install PowerLevel10k theme
268-
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
259+
# Install PowerLevel10k theme
260+
if [[ ! -d "$HOME/powerlevel10k" ]]; then
261+
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "$HOME/powerlevel10k"
262+
fi
269263

270264
# Create symlinks for zshrc and p10k.zsh config
271-
# But backup the current one so that
272-
# symlinks can be created.
273-
mv "/Users/$(whoami)/.zshrc" "/Users/$(whoami)/.zshrc.bak"
274-
mv "/Users/$(whoami)/.p10k.zsh" "/Users/$(whoami)/.p10k.zsh.bak"
275-
ln -s "/Users/$(whoami)/dotfiles/.zshrc" "/Users/$(whoami)/.zshrc"
276-
ln -s "/Users/$(whoami)/dotfiles/.p10k.zsh" "/Users/$(whoami)/.p10k.zsh"
277-
278-
# Install fonts for powerline 10k
279-
280-
test ! -f ~/Library/Fonts/MesloLGS\ NF\ Bold\ Italic.ttf && curl https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf > ~/Library/Fonts/MesloLGS\ NF\ Bold\ Italic.ttf
281-
test ! -f ~/Library/Fonts/MesloLGS\ NF\ Regular.ttf && curl https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf > ~/Library/Fonts/MesloLGS\ NF\ Regular.ttf
282-
test ! -f ~/Library/Fonts/MesloLGS\ NF\ Italic.ttf && curl https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf > ~/Library/Fonts/MesloLGS\ NF\ Italic.ttf
283-
test ! -f ~/Library/Fonts/MesloLGS\ NF\ Bold.ttf && curl https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf > ~/Library/Fonts/MesloLGS\ NF\ Bold.ttf
265+
# Backup existing files if they exist and are not symlinks
266+
[[ -f "$HOME/.zshrc" && ! -L "$HOME/.zshrc" ]] && mv "$HOME/.zshrc" "$HOME/.zshrc.bak"
267+
[[ -f "$HOME/.p10k.zsh" && ! -L "$HOME/.p10k.zsh" ]] && mv "$HOME/.p10k.zsh" "$HOME/.p10k.zsh.bak"
268+
ln -sf "$HOME/dotfiles/.zshrc" "$HOME/.zshrc"
269+
ln -sf "$HOME/dotfiles/.p10k.zsh" "$HOME/.p10k.zsh"
270+
271+
# Install fonts for PowerLevel10k
272+
mkdir -p "$HOME/Library/Fonts"
273+
curl -fLo "$HOME/Library/Fonts/MesloLGS NF Bold Italic.ttf" --create-dirs \
274+
"https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf"
275+
curl -fLo "$HOME/Library/Fonts/MesloLGS NF Regular.ttf" \
276+
"https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf"
277+
curl -fLo "$HOME/Library/Fonts/MesloLGS NF Italic.ttf" \
278+
"https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf"
279+
curl -fLo "$HOME/Library/Fonts/MesloLGS NF Bold.ttf" \
280+
"https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf"
284281

285282

286283
# Remove outdated versions from the cellar

0 commit comments

Comments
 (0)