Last active
June 22, 2024 12:56
-
-
Save revunix/8be684bcb5fe7cd1f39f6ab082f4e5dc to your computer and use it in GitHub Desktop.
Homebrew install script with personal changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo -v | |
sudo spctl --master-disable | |
red='\e[1;31m%s\e[0m\n' | |
green='\e[1;32m%s\e[0m\n' | |
binaries=( | |
fish | |
git | |
htop | |
wget | |
yt-dlp | |
tree | |
ffmpeg | |
topgrade | |
mas | |
android-platform-tools | |
gh | |
bun | |
tmux | |
fwartner/tap/mac-cleanup | |
#zsh-completions | |
#zsh-syntax-highlighting | |
#navi | |
#thefuck | |
#sshfs-macbun | |
) | |
casks=( | |
1password | |
1password-cli | |
airbuddy | |
android-platform-tools | |
anydesk | |
arc | |
discord | |
discord-ptb | |
elgato-stream-deck | |
eloston-chromium | |
equinox | |
google-chrome-canary | |
iina | |
imazing | |
iterm2 | |
itraffic | |
keka | |
kekaexternalhelper | |
linearmouse | |
mullvadvpn | |
mysteriumdark | |
obs-beta | |
orbstack | |
pearcleaner | |
prismlauncher | |
raycast | |
replacicon | |
rode-central | |
sf-symbols | |
shottr | |
soundsource | |
spotify | |
teamspeak-client-prerelease | |
telegram | |
vial | |
visual-studio-code | |
yubico-yubikey-manager | |
#brave-browser | |
#bettermouse (using linearmouse insted) | |
#eloston-chromium | |
#logi-options-plus | |
#swiftcord | |
#trex | |
#macfuse | |
) | |
masapps=( | |
1569813296 #1Password for Safari (2.17.1) | |
1437809329 #Surfshark (4.12.3) | |
1659154653 #Mona (5.10.4) | |
1351639930 #Gifski (2.23.0) | |
1136220934 #Infuse (7.6.4) | |
310633997 #WhatsApp (23.23.81) | |
1615798039 #ReadKit (3.1.9) | |
1451685025 #WireGuard (1.0.16) | |
6448461551 #Command X (1.3.0) | |
) | |
help() { | |
echo | |
echo "Syntax: install.sh [-h|i|u|s|l|m|t|v]" | |
echo "options:" | |
echo "-i install Homebrew" | |
echo "-s change new default settings" | |
echo "-u force a update (you need topgrade)" | |
echo "-l show ~/Library folder again" | |
echo "-m install MiniFuse Control Center (Audio Interface)" | |
echo "-t reset TeamViewer ID" | |
echo "-v install vcode extensions" | |
echo "-k Installing Mac U.S. keyboard layout with German Umlauts" | |
echo "-h print this Help." | |
echo | |
} | |
homebrew() { | |
if test ! $(/usr/bin/pgrep oahd); then | |
printf "$green" "Enabling Rosetta 2" | |
/usr/sbin/softwareupdate --install-rosetta --agree-to-license | |
else | |
printf "$red" "(skipped) | Rosetta 2 already enabled" | |
fi | |
if test ! $(which xcode-select); then | |
printf "$green" "Installing Xcode command-line tools" | |
xcode-select --install | |
else | |
printf "$red" "(skipped) | Xcode command-line tools already installed" | |
fi | |
if test ! $(which brew); then | |
printf "$green" "Installing homebrew..." | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
else | |
printf "$red" "(skipped) | Homebrew already installed" | |
fi | |
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >>~/.zprofile | |
eval "$(/opt/homebrew/bin/brew shellenv)" | |
brew tap homebrew/cask-versions | |
brew tap homebrew/cask-drivers | |
brew tap buo/cask-upgrade | |
brew tap revunix/repo | |
brew tap oven-sh/bun | |
brew tap melonamin/formulae | |
brew tap gromgit/fuse | |
} | |
apps() { | |
printf "$green" "Installing Binaries..." | |
brew install ${binaries[@]} | |
printf "$green" "Installing Apps..." | |
brew install ${casks[@]} --cask | |
printf "$green" "Installing MAS..." | |
mas install ${masapps[@]} | |
} | |
settings() { | |
printf "$green" "Configuring macOS..." | |
# Rename Mac name | |
scutil --set ComputerName 'myMac' | |
sudo hostname -s 'myMac' | |
# Require password immediately after sleep or screen saver begins | |
defaults write com.apple.screensaver askForPassword -int 1 | |
defaults write com.apple.screensaver askForPasswordDelay -int 5 | |
# Finder: show all filename extensions | |
defaults write NSGlobalDomain AppleShowAllExtensions -bool false | |
# Enable spring loading for directories | Remove the spring loading delay for directories | |
defaults write NSGlobalDomain com.apple.springing.enabled -bool true | |
defaults write NSGlobalDomain com.apple.springing.delay -float 0 | |
# Adjust toolbar title rollover delay | |
defaults write NSGlobalDomain NSToolbarTitleViewRolloverDelay -float 0 | |
# Finder: show status bar | |
defaults write com.apple.finder ShowStatusBar -bool true | |
# Finder: show path bar | |
defaults write com.apple.finder ShowPathbar -bool true | |
# Save screenshots to the desktop | |
defaults write com.apple.screencapture location -string "${HOME}/Desktop" | |
# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) | |
defaults write com.apple.screencapture type -string "png" | |
# Disable shadow in screenshots | |
defaults write com.apple.screencapture disable-shadow -bool true | |
# Enable subpixel font rendering on non-Apple LCDs | |
# Reference: https://github.com/kevinSuttle/macOS-Defaults/issues/17#issuecomment-266633501 | |
defaults write NSGlobalDomain AppleFontSmoothing -int 1 | |
defaults write NSGlobalDomain CGFontRenderingFontSmoothingDisabled -bool false | |
# Enable HiDPI display modes (requires restart) | |
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true | |
# Avoid creating .DS_Store files on network or USB volumes | |
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true | |
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true | |
# Set the icon size of Dock items to 36 pixels | |
defaults write com.apple.dock tilesize -int 46 | |
# Change minimize/maximize window effect ("scale" or "genie") | |
defaults write com.apple.dock mineffect -string genie | |
# Disable the warning when changing a file extension | |
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false | |
# Remove the auto-hiding Dock delay | |
defaults write com.apple.dock autohide-delay -float 0 | |
# Remove the animation when hiding/showing the Dock | |
defaults write com.apple.dock autohide-time-modifier -float 0.5 | |
# Set ${HOME} as the default location for new Finder windows | |
# Computer : `PfCm` | |
# Volume : `PfVo` | |
# $HOME : `PfHm` | |
# Desktop : `PfDe` | |
# Documents : `PfDo` | |
# All My Files : `PfAF` | |
# Other… : `PfLo` | |
defaults write com.apple.finder NewWindowTarget -string "PfHm" | |
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/" | |
# Disable the warning before emptying the Trash | |
defaults write com.apple.finder WarnOnEmptyTrash -bool false | |
# Hot corners | |
defaults write com.apple.dock wvous-bl-corner -int 5 | |
defaults write com.apple.dock wvous-br-corner -int 4 | |
defaults write com.apple.dock wvous-tl-corner -int 4 | |
defaults write com.apple.dock wvous-tr-corner -int 4 | |
# Turn on app auto-update | |
defaults write com.apple.commerce AutoUpdate -bool true | |
# Install System data files & security updates | |
defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1 | |
# Download newly available updates in background | |
defaults write com.apple.SoftwareUpdate AutomaticDownload -int 1 | |
# Turn on automatic checking for updates | |
sudo softwareupdate --schedule on | |
# Enable the automatic update check | |
defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true | |
# Prevent Photos from opening automatically when devices are plugged in | |
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true | |
# Link legacy youtube-dl binary to maintained yt-dlp. Sources: | |
# https://github.com/iina/iina/issues/3327#issuecomment-998184733 | |
# https://github.com/iina/iina/issues/3502 | |
sudo rm /Applications/IINA.app/Contents/MacOS/youtube-dl | |
sudo ln -fs $(which yt-dlp) /Applications/IINA.app/Contents/MacOS/youtube-dl | |
printf "$green" "Enable SMB for FritzNAS" | |
cat <<EOT >>~/Library/Preferences/nsmb.conf | |
[default] | |
protocol_vers_map=2 | |
EOT | |
} | |
library() { | |
printf "$green" "~/Library folder is not hidden anymore!" | |
if [[ $(xattr -l ~/Library | grep com.apple.FinderInfo) == "" ]]; then | |
: | |
else | |
xattr -d com.apple.FinderInfo ~/Library | |
fi | |
chflags nohidden ~/Library | |
} | |
ztweak() { | |
if [ -d ~/.oh-my-zsh ]; then | |
printf "$red" "(skipped) | oh-my-zsh already installed" | |
else | |
printf "$green" "Installing oh-my-zsh..." | |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" | |
fi | |
printf "$green" "Installig ZSH Autosuggestions" | |
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions | |
printf "$green" "Installig ZSH Syntax Highlighting" | |
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting | |
printf "$green" "Adding plugins to ~/.zshrc" | |
sed -i -e 's/plugins=(git)/plugins=(git zsh-autosuggestions zsh-syntax-highlighting)/g' ~/.zshrc | |
printf "$green" "Paste few things into ~/.zshrc" | |
cat <<EOT >>~/.zshrc | |
alias zshconfig="nano ~/.zshrc" | |
alias ohmyzsh="nano ~/.oh-my-zsh" | |
alias n="nano" | |
alias m="mkdir" | |
alias c="clear" | |
alias update="topgrade" | |
alias yt="yt-dlp" | |
eval $(thefuck --alias) | |
EOT | |
} | |
minifuse() { | |
printf "$green" "Installing ARTURIA MiniFuse Control Center" | |
curl -L https://dl.arturia.net/products/mfcc/soft/MiniFuse_Control_Center_1_1_1_448.pkg >~/Downloads/arturia.pkg && | |
sudo installer -pkg ~/Downloads/arturia.pkg -target / && | |
rm -rf ~/Downloads/arturia.pkg | |
} | |
vcode() { | |
printf "$green" "Installing Visual Studio Code Extensions" | |
code --install-extension PKief.material-icon-theme | |
code --install-extension ms-azuretools.vscode-docker | |
code --install-extension esbenp.prettier-vscode | |
code --install-extension dracula-theme.theme-dracula | |
code --install-extension foxundermoon.shell-format | |
} | |
key_umlauts() { | |
printf "$green" "Installing Mac U.S. keyboard layout with German Umlauts" | |
curl -sL https://api.github.com/repos/patrick-zippenfenig/us-with-german-umlauts/tarball/master | sudo tar xz --exclude=README.md --strip=1 -C /Library/Keyboard\ Layouts/ | |
} | |
while getopts ":uihslaztmvfk" option; do | |
case $option in | |
i) | |
homebrew | |
exit | |
;; | |
s) | |
settings | |
exit | |
;; | |
a) | |
apps | |
exit | |
;; | |
u) | |
topgrade | |
exit | |
;; | |
k) | |
key_umlauts | |
exit | |
;; | |
l) | |
library | |
exit | |
;; | |
z) | |
ztweak | |
exit | |
;; | |
m) | |
minifuse | |
exit | |
;; | |
f) | |
vcode | |
exit | |
;; | |
h) | |
help | |
exit | |
;; | |
\?) | |
echo "Error: Invalid option" | |
exit | |
;; | |
esac | |
done | |
echo "I did nothing yet, check -h for help" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment