Last active
May 26, 2025 16:17
-
-
Save bruno-novo-it/3ab435fc3239470ff411aa635dd3b793 to your computer and use it in GitHub Desktop.
Fresh MacOS Installation Script
This file contains hidden or 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 | |
echo -e "\nInstalling all the things for MacOS!!\n" | |
echo -e "\nInstalling Homebrewβ¦\n" | |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
echo -e "\nFix --> \"Application X\" cannot be opened because the developer cannot be verifiedβ¦\n" | |
sudo spctl --master-disable | |
brew tap hashicorp/tap | |
# https://github.com/robscott/kube-capacity | |
brew tap robscott/tap | |
# TFenv β> https://github.com/tfutils/tfenv | |
echo -e " \ | |
Installing: \n \ | |
Iterm2 \n \ | |
Bash \n \ | |
Wget \n \ | |
Git \n \ | |
Watch \n \ | |
Zsh \n \ | |
Colima \n \ | |
Docker-cli \n \ | |
Docker Compose \n \ | |
Docker Buildx \n \ | |
Kubectl \n \ | |
Popeye \n \ | |
TFenv \n \ | |
TGenv \n \ | |
Asdf \n \ | |
AWS cli \n \ | |
Jq \n \ | |
OpenJDK \n \ | |
Htop \n \ | |
Bash-Completion \n \ | |
Terraformer \n \ | |
Helm3 \n \ | |
Go \n \ | |
GitHub Cli \n \ | |
DNSMasq \m \ | |
Hyperkit \n \ | |
Tree \n \ | |
Telnet \n \ | |
Libpq \n \ | |
ipcalc \n \ | |
Vault\n \ | |
Kube-Capacity \n \ | |
Pre-Commit \n \ | |
Helm-docs \n \ | |
Neofetch \n \ | |
Kustomize \n \ | |
Colima \n \ | |
Ansible \n \ | |
Botton \n \ | |
Helmify \n \ | |
Flux \n \ | |
Android Platform Tools \n \ | |
Ffmpeg \n \ | |
OpenJDK \n \ | |
Pyenv \n \ | |
Core Utils\n" | |
brew install iterm2 \ | |
bash \ | |
wget \ | |
git \ | |
watch \ | |
zsh \ | |
colima \ | |
docker \ | |
docker-compose \ | |
docker-buildx \ | |
kubectl \ | |
derailed/popeye/popeye \ | |
tfenv \ | |
tgenv \ | |
asdf \ | |
awscli \ | |
jq \ | |
openjdk \ | |
htop \ | |
bash-completion \ | |
terraformer \ | |
helm \ | |
go \ | |
gh \ | |
dnsmasq \ | |
hyperkit \ | |
tree \ | |
telnet \ | |
libpq \ | |
ipcalc \ | |
hashicorp/tap/vault \ | |
robscott/tap/kube-capacity \ | |
pre-commit \ | |
norwoodj/tap/helm-docs \ | |
neofetch \ | |
kustomize \ | |
colima \ | |
ansible \ | |
botton \ | |
helmify \ | |
fluxcd/tap/flux \ | |
android-platform-tools \ | |
ffmpeg \ | |
openjdk \ | |
pyenv \ | |
coreutils | |
# Compose is now a Docker plugin. For Docker to find this plugin, symlink it: | |
mkdir -p ~/.docker/cli-plugins | |
ln -sfn /usr/local/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose | |
mkdir -p /Applications/Docker.app/Contents/Resources/cli-plugins | |
# Fix docker login issues --> https://github.com/docker/docker-credential-helpers/issues/149#issuecomment-566832756 | |
sed -i '' 's/"credsStore": "desktop",//' ~/.docker/config.json | |
### Docker BuildX | |
echo -e "Docker Buildx install" | |
mkdir -p ~/.docker/cli-plugins | |
ln -sfn /opt/homebrew/bin/docker-buildx ~/.docker/cli-plugins/docker-buildx | |
docker buildx install | |
## asdf --> https://asdf-vm.com/ # Manage multiple runtime version with a single CLI tool | |
echo -e "asdf Install Nova - Helm find new releases" | |
asdf plugin add nova | |
asdf install nova latest | |
asdf global nova latest | |
brew tap homebrew/cask-versions | |
echo -e " \ | |
Installing: \n \ | |
Android File Transfer \n \ | |
Google Chrome \n \ | |
VS Code \n \ | |
Beaver \n \ | |
Postman \n \ | |
Lens(Kubernetes IDE) \n \ | |
Google Cloud SDK \n \ | |
Slack \n \ | |
Spotify \n \ | |
VLC \n \ | |
ChromeDriver \n \ | |
TeamViewer \n \ | |
JDownloader \n \ | |
Zoom \n \ | |
Adobe Acrobat Reader \n \ | |
Authy \n \ | |
KeePassXC \n \ | |
qbittorrent \n \ | |
Codium \n \ | |
The Unarchiver \n \ | |
Discord \n \ | |
Telegram Desktop \n \ | |
Open In Terminal \n \ | |
Temurin \n \ | |
Android CommandLine Tools\n" | |
brew install --cask android-file-transfer \ | |
google-chrome \ | |
visual-studio-code \ | |
dbeaver-community \ | |
postman \ | |
lens \ | |
google-cloud-sdk \ | |
slack \ | |
spotify \ | |
vlc \ | |
chromedriver \ | |
teamviewer \ | |
jdownloader \ | |
zoom \ | |
adobe-acrobat-reader \ | |
authy \ | |
keepassxc \ | |
qbittorrent \ | |
vscodium \ | |
the-unarchiver \ | |
discord \ | |
telegram-desktop \ | |
openinterminal \ | |
temurin \ | |
android-commandlinetools | |
echo -e "Install gke-gcloud-auth-plugin" | |
gcloud components install gke-gcloud-auth-plugin | |
# Remove file from quarantine | |
echo -e "Remove ChromeDriver from Quarantine" | |
xattr -d com.apple.quarantine chromedriver | |
echo -e "VSCodium settings.json configuration" | |
sudo true > $HOME/Library/Application\ Support/VSCodium/User/settings.json | |
sudo cat <<EOF >> $HOME/Library/Application\ Support/VSCodium/User/settings.json | |
{ | |
"workbench.startupEditor": "none", | |
"terminal.integrated.fontFamily": "Monaco,ProFont for Powerline", | |
"terminal.integrated.copyOnSelection": true, | |
"terminal.integrated.rightClickBehavior": "paste", | |
"workbench.iconTheme": "vscode-icons", | |
"redhat.telemetry.enabled": true, | |
"security.workspace.trust.untrustedFiles": "open", | |
"vsicons.dontShowNewVersionMessage": true, | |
"vs-kubernetes": { | |
"vs-kubernetes.crd-code-completion": "disabled", | |
"vscode-kubernetes.kubectl-path.mac": "/Users/bruno/.vs-kubernetes/tools/kubectl/kubectl" | |
}, | |
"terminal.integrated.enableMultiLinePasteWarning": "auto", | |
"search.followSymlinks": false, | |
"files.exclude": { | |
"**/.git": true, | |
"**/.svn": true, | |
"**/.hg": true, | |
"**/CVS": true, | |
"**/.DS_Store": true, | |
"**/tmp": true, | |
"**/node_modules": true, | |
"**/bower_components": true, | |
"**/dist": true, | |
"**/.yarn/cache": true | |
}, | |
"files.watcherExclude": { | |
"**/.git/objects/**": true, | |
"**/.git/subtree-cache/**": true, | |
"**/node_modules/**": true, | |
"**/.yarn/cache/**": true, | |
"**/.expo/**": true, | |
"**/tmp/**": true, | |
"**/bower_components/**": true, | |
"**/dist/**": true, | |
"**/vendor/**": true, | |
"assets/**": true, | |
"backup/**": true, | |
"bin/**": true, | |
"cache/**": true, | |
"images/**": true, | |
"logs/**": true, | |
"system/**": true, | |
"tmp/**": true, | |
"webserver-configs/**": true | |
}, | |
"files.insertFinalNewline": true | |
} | |
EOF | |
VSCODE_EXTENSIONS=( | |
bierner.markdown-mermaid | |
christian-kohler.path-intellisense | |
davidanson.vscode-markdownlint | |
dbaeumer.vscode-eslint | |
dracula-theme.theme-dracula | |
esbenp.prettier-vscode | |
golang.go | |
grapecity.gc-excelviewer | |
hashicorp.hcl | |
hashicorp.terraform | |
ms-azuretools.vscode-docker | |
ms-kubernetes-tools.vscode-kubernetes-tools | |
ms-python.python | |
redhat.vscode-yaml | |
shardulm94.trailing-spaces | |
shd101wyy.markdown-preview-enhanced | |
tomoki1207.pdf | |
vscode-icons-team.vscode-icons | |
waderyan.gitblame | |
yzhang.markdown-all-in-one | |
) | |
echo -e "\nInstalling VS Code Extensions\n" | |
for extension in ${VSCODE_EXTENSIONS[@]} | |
do code --install-extension $extension | |
done | |
# Utility to test wildcard domains locally(*.example.localhost) | |
# DNS Masq curl Example after configuration | |
# curl --resolve prometheus.example.localhost:80:127.0.0.1 http://prometheus.example.localhost | |
# curl -k --resolve prometheus.example.localhost:443:127.0.0.1 https://prometheus.example.localhost | |
echo -e "\nConfiguring Localhost DnsMasq\n" | |
cat <<EOF >> /usr/local/etc/dnsmasq.conf | |
# example.localhost will be resolved as 127.0.0.1, including subdomains | |
# https://hedichaibi.com/how-to-setup-wildcard-dev-domains-with-dnsmasq-on-a-mac/ | |
address=/example.localhost/127.0.0.1 | |
listen-address=127.0.0.1 | |
EOF | |
brew services stop dnsmasq && brew services start dnsmasq | |
echo -e "\nCurlsyscall ssl error fix" | |
# https://stackoverflow.com/questions/55732972/curl-56-libressl-ssl-read-ssl-error-syscall-errno-54 | |
echo '--no-alpn' > ~/.curlrc | |
echo -e "\nOpenJDK Path Symlink" | |
sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk | |
echo -e "\nSDKManager and AVDManager Configuration" | |
sdkmanager "emulator" | |
# Then Accept all licenses | |
yes | sdkmanager --licenses | |
ANDROID_VERSION=android-35 | |
ARCH_TYPE=arm64-v8a | |
sdkmanager --install "system-images;${ANDROID_VERSION};google_apis_playstore;${ARCH_TYPE}" | |
echo "no" | avdmanager --verbose create avd --force \ | |
--name "android_35" \ | |
--package "system-images;${ANDROID_VERSION};google_apis_playstore;${ARCH_TYPE}" \ | |
--tag "google_apis_playstore" \ | |
--abi "${ARCH_TYPE}" | |
avdmanager list avd | |
echo -e "\nAdding ZProfile file" | |
rm -rf ~/.zprofile | |
cat <<EOF >> ~/.zprofile | |
export PYENV_ROOT="\$HOME/.pyenv" | |
command -v pyenv >/dev/null || export PATH="\$PYENV_ROOT/bin:\$PATH" | |
eval "\$(pyenv init -)" | |
EOF | |
echo -e "\nInstalling Oh My Zsh..\n" | |
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" | |
echo -e "\nInstalling zsh Completion\n" | |
# https://github.com/ohmyzsh/ohmyzsh | |
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions | |
echo -e "\nInstalling zsh Syntax HighLighting\n" | |
git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-syntax-highlighting | |
echo -e "\nInstalling autosuggestions latest version\n" | |
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-autosuggestions | |
echo -e "\nInstalling Powerline Extra Fonts latest version\n" | |
# https://github.com/powerline/fonts | |
git clone https://github.com/powerline/fonts.git --depth=1 && \ | |
cd fonts && \ | |
./install.sh | |
echo -e "\nRemoving Powerline Font Git Repository\n" | |
cd .. && rm -rf fonts | |
echo -e "\nRemoving and Adding zshrc Variables" | |
rm -rf ~/.zshrc | |
mkdir $HOME/go | |
cat <<EOF >> ~/.zshrc | |
export ZSH="\${HOME}/.oh-my-zsh" | |
ZSH_THEME="agnoster" | |
HISTSIZE=1000000 | |
plugins=( | |
git | |
zsh-completions | |
zsh-autosuggestions | |
zsh-syntax-highlighting | |
kubectl | |
docker | |
docker-compose | |
history | |
git-flow | |
python | |
terraform | |
asdf | |
pyenv | |
) | |
source \$ZSH/oh-my-zsh.sh | |
DEFAULT_USER=\$USER | |
## ZSH expansion modifiers/flags and Bash parameter expansion | |
## https://scriptingosx.com/2019/12/upper-or-lower-casing-strings-in-bash-and-zsh/ | |
prompt_context() { | |
# Custom (Random emoji) | |
emojis=("β‘οΈ" "π₯" "π" "π" "π" "πΈ" "π΅" "π»" "π" "π‘" "π" "π" "π¦" "π") | |
RAND_EMOJI_N=\$(( \$RANDOM % \${#emojis[@]} + 1)) | |
prompt_segment black default "\${emojis[\$RAND_EMOJI_N]} " | |
} | |
### Usefull Functions ### | |
update_upgrade_autoremove() { | |
brew update && brew upgrade && brew autoremove && brew cleanup && omz update | |
} | |
atouch() { | |
mkdir -p \$(sed 's/\(.*\)\/.*/\1/' <<< \$1) && touch \$1 | |
} | |
decode () { | |
echo \$1 | base64 -d | |
echo "" | |
} | |
encode () { | |
echo \$1 | base64 | |
echo "" | |
} | |
list_dir_size() { | |
du -schx .[!.]* * | sort -h | |
} | |
find_file() { | |
if [ -z "\$1" ] | |
then | |
echo "You Need to specify the file you need!" | |
fi | |
IFS=$'\n'; for i in `find . -iname \$1`; do echo comando -f -- \"\$i\" ; done | |
} | |
## https://canererden.com/blog/2023/unlock-medium/ | |
## https://chrome.google.com/webstore/detail/text-mode-for-websites-re/phjbepamfhjgjdgmbhmfflhnlohldchb | |
chrome_read_unlimited() { | |
if [[ -z "\$1" ]]; then | |
echo "Please, you need to pass a URL" | |
echo "Ex.: \$0 https://google.com" | |
return 0 | |
fi | |
open -a "Google Chrome" "http://webcache.googleusercontent.com/search?q=cache:\$1&sca_esv=556757575&strip=1&vwsrc=0" | |
} | |
## https://github.com/abiosoft/colima --> Docker Desktop Substitute | |
## To use amd64 arch, just change to --arch amd64 instead of --arch aarch64 | |
colima_main() { | |
if [[ "\$1" == "start" ]]; then | |
colima start --profile mac --arch aarch64 --vm-type=vz --vz-rosetta --cpu 6 --memory 12 | |
elif [[ "\$1" == "stop" ]]; then | |
colima --profile mac stop | |
else | |
echo "Please, provide start|stop" | |
echo "Ex.: \$0 start" | |
return 0 | |
fi | |
} | |
colima_kubernetes() { | |
if [[ "\$1" == "start" ]]; then | |
colima --profile mac kubernetes start | |
elif [[ "\$1" == "stop" ]]; then | |
colima --profile mac kubernetes stop | |
else | |
echo "Please, provide start|stop" | |
echo "Ex.: \$0 start" | |
return 0 | |
fi | |
# kubectl config use-context colima | |
} | |
export HOMEBREW_NO_ENV_HINTS=1 | |
export HOMEBREW_CURLRC=1 | |
export GOOGLE_AUTH_SUPPRESS_CREDENTIALS_WARNINGS=1 | |
export USE_GKE_GCLOUD_AUTH_PLUGIN=True | |
. /usr/local/opt/asdf/libexec/asdf.sh | |
#### GO ### | |
## https://github.com/golang/go/wiki/SettingGOPATH | |
export GOPROXY=direct | |
export GOROOT=\$HOME/go/ | |
export PATH=\$PATH:\$GOROOT/bin | |
alias pbcopy="xclip -selection clipboard" | |
alias pbpaste="xclip -selection clipboard -o" | |
alias pip=pip3 | |
alias python=python3 | |
alias code=codium | |
## https://unix.stackexchange.com/questions/709613/ssh-working-on-all-devices-but-scp-from-some-devices-gives-connection-closed-e | |
alias scp="scp -O" | |
## https://stackoverflow.com/questions/18215389/how-do-i-measure-request-and-response-times-at-once-using-curl | |
alias curltime="curl -w 'time_namelookup: %{time_namelookup}s | |
time_connect: %{time_connect}s | |
time_appconnect: %{time_appconnect}s | |
time_pretransfer: %{time_pretransfer}s | |
time_redirect: %{time_redirect}s | |
time_starttransfer: %{time_starttransfer}s | |
---------- | |
time_total: %{time_total}s | |
response_code: %{response_code}' -o /dev/null -s" | |
export PATH="/opt/homebrew/opt/libpq/bin:\$PATH" | |
export PATH="/usr/local/sbin:\$PATH" | |
export JAVA_HOME="/Library/Java/JavaVirtualMachines/openjdk.jdk/Contents/Home" | |
export PATH="/usr/local/opt/openjdk/bin:\$PATH" | |
eval "\$(/opt/homebrew/bin/brew shellenv)" | |
export ANDROID_HOME=`brew --prefix`/share/android-commandlinetools | |
export PATH=\$PATH:\$ANDROID_HOME/emulator | |
export PATH=\$PATH:\$ANDROID_HOME/tools | |
export PATH=\$PATH:\$ANDROID_HOME/tools/bin | |
export PATH=\$PATH:\$ANDROID_HOME/platform-tools | |
export ANDROID_SDK_ROOT=\$ANDROID_HOME | |
export PYENV_ROOT="\$HOME/.pyenv" | |
command -v pyenv >/dev/null || export PATH="\$PYENV_ROOT/bin:\$PATH" | |
eval "\$(pyenv init -)" | |
autoload -Uz compinit && compinit | |
EOF | |
echo -e "\nCleaning and Upgrading Packages\n" | |
brew update && \ | |
brew upgrade && \ | |
brew autoremove && \ | |
brew cleanup | |
# Change Shell to ZSH | |
chsh -s $(which zsh) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment