HomeBrew – Mac OS Setup

| | | |

I use a Mac for my primary computer and sometimes I need to setup a new VM similar to my computer for testing.

Here is the basic setup that I use HomeBrew for. I’ll add more later as I remember more or use it more.

Bash – Setup
# Install HomeBrew

if ! type "brew" > /dev/null; then
  #/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)";
  /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)";
fi

NOTE: If you receive an error on installing HomeBrew like “Error: Failed to link all completions, docs and manpages: Permission denied” try this

Bash – Install Applications
# This command should work
sudo chown -R $USER:admin /usr/local/*

# If the above doesn't work use this (of course change the username 'dkittell' to your username
sudo chown -R dkittell:admin /usr/local/*
[/code]Bash - Setup# Install HomeBrew

if ! type "brew" > /dev/null; then
  #/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)";
  /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)";
fi# Install HomeBrew

if ! type "brew" > /dev/null; then
  #/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)";
  /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)";
fi

[code language="bash" title="Install Applications"]
# If you work with Virtual Machines these two lines will be helpful
brew cask install vagrant;
brew cask install virtualbox;

# Install Python Pip
sudo easy_install pip

# Install BashBeautify
sudo pip install --upgrade bashbeautify

# Install Azure CLI
brew install azure-cli

# Install Amazon (AWS) CLI
brew install awscli

# Install Telnet
brew install telnet

# Install Visual Studio Code
brew cask install visual-studio-code
open /Applications/Visual\ Studio\ Code.app
# Once in Visual Studio Code - Command+Shift+P
# shell command
# Back to Terminal
# Install Azure CLI
code --install-extension ms-vscode.azurecli
# Install HTML/CSS/JS Beautifier
code --install-extension HookyQR.beautify
# Install PHP Beautifier
cd ~/ && curl -sS https://getcomposer.org/installer | php && cp composer.phar /usr/local/bin/composer && sudo chmod +x /usr/local/bin/composer && composer global require friendsofphp/php-cs-fixer
code --install-extension junstyle.php-cs-fixer
echo "{" >> ~/Library/Application\ Support/Code/User/settings.json
echo "\"php-cs-fixer.executablePath\": \"~/.composer/vendor/bin/php-cs-fixer\"" >> ~/Library/Application\ Support/Code/User/settings.json
echo "}" >> ~/Library/Application\ Support/Code/User/settings.json
# Install FTP-Sync
code --install-extension lukasz-wronski.ftp-sync

# Install Java JDK
brew cask install java

# Install Eclipse C++
brew cask install eclipse-cpp

# Install Skype
brew cask install skype

# Install DropBox
brew cask install dropbox

# Install Google Drive
brew cask install google-drive-file-stream

# Install Google Chrome
brew cask install google-chrome

# Install YouTube Downloader CLI
brew install youtube-dl

# Install ffmpeg with plugins
brew install ffmpeg --with-vpx --with-vorbis --with-libvorbis --with-vpx --with-vorbis --with-theora --with-libogg --with-libvorbis --with-gpl --with-version3 --with-nonfree --with-postproc --with-libaacplus --with-libass --with-libcelt --with-libfaac --with-libfdk-aac --with-libfreetype --with-libmp3lame --with-libopencore-amrnb --with-libopencore-amrwb --with-libopenjpeg --with-openssl --with-libopus --with-libschroedinger --with-libspeex --with-libtheora --with-libvo-aacenc --with-libvorbis --with-libvpx --with-libx264 --with-libxvid

# Install Redis - CLI is all I care about
brew install redis
# If you want full Redis server follow https://gist.github.com/nrollr/eb24336b8fb8e7ba5630

# Install JQ (JSON Parser)
brew install jq

# Install FileZilla (FTP Client)
brew cask install filezilla

# Install PowerShell
brew install --cask powershell

# Install cdparanoia (CD Track Ripper), lame (MP3 conversion), and wget
brew install cdparanoia lame wget
Bash – Install Oh My Zsh (Bash Alternative)
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

# Change Theme to Avit Theme (OPTIONAL)
cat .zshrc | grep ZSH_THEME
sed -i '.original' 's/ZSH_THEME="robbyrussell"/ZSH_THEME="avit"/gp' ~/.zshrc
cat .zshrc | grep ZSH_THEME

Incidentally if you want/need to uninstall HomeBrew or Oh My Zsh

Bash – Remove HomeBrew
# Remove everything installed with HomeBrew
brew list -1 | xargs brew rm

# Remove HomeBrew (In some cases Sudo is not needed)
#sudo /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
sudo /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
sudo rm -rf /usr/local/Homebrew/.github/
sudo rm -rf /usr/local/Homebrew/bin/
sudo rm -rf /usr/local/Homebrew/completions/
sudo rm -rf /usr/local/Homebrew/docs/
sudo rm -rf /usr/local/Homebrew/Library/
sudo rm -rf /usr/local/Homebrew/manpages/
sudo rm -rf /usr/local/etc/openssl
sudo rm -rf /usr/local/etc/wgetrc
sudo rm -rf /usr/local/microsoft/powershell
sudo rm -rf /usr/local/Caskroom/
sudo rm -rf /usr/local/bin/powershell
sudo rm -rf /usr/local/Homebrew/
sudo rm -rf /usr/local/remotedesktop/
sudo rm -rf /usr/local/var/homebrew/

# Remove Oh My Zsh
cd ~/
sh .oh-my-zsh/tools/uninstall.sh
rm -rf .oh-my-zsh
rm -rf .zsh-update
rm -rf .zsh_history
rm -rf .zshrc
rm -rf .zshrc.*
rm -rf .zcompdump*
chsh -s /bin/bash

One thing to note is after you uninstall Oh My Zsh you may need to close and reopen Terminal to see the difference.

Originally Posted on March 15, 2017
Last Updated on May 6, 2026
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.