Skip to content

Instantly share code, notes, and snippets.

@seven62
Last active September 20, 2021 16:04
Show Gist options
  • Save seven62/2c907c8b1ab84cb9a9dd0f67abd4fc98 to your computer and use it in GitHub Desktop.
Save seven62/2c907c8b1ab84cb9a9dd0f67abd4fc98 to your computer and use it in GitHub Desktop.
Script and readme to configure a new mac
#!/bin/bash
#set -eux
# Create Profile Directories
mkdir ~/{bin,code,dev}
# Install CLI Tools
clear
echo "############################"
echo "### Installing CLI Tools ###"
echo "############################"
sleep 2
brew install \
ansible \
ansible-lint \
bash \
bash-completion \
bat \
broot \
git \
htop \
jq \
jsonlint \
make \
mkdocs \
nmap \
noti \
packer \
packer-completion \
pyenv \
qemu \
shellcheck \
tldr \
tmux \
vagrant-completion \
vifm \
wireguard-tools \
yamllint
## Import Dotfiles
# TODO
## Bash Completion (completion)
# Finishing this up by appending to bash profile
cat << EOF >> ~/.bash_profile
# bash completion
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
EOF
clear
echo "############################"
echo "### Installing GUI Tools ###"
echo "### password is required ###"
echo "############################"
sleep 2
# Install GUI Tools
brew cask install \
alfred \
appcleaner \
authy \
balenaetcher \
github \
iterm2 \
itsycal \
lulu \
mark-text \
notion \
rectangle \
skitch \
slack \
vagrant \
vagrant-manager \
vlc \
zoom
# Browser
echo "### Installing Browser(s) ###"
brew cask install \
google-chrome \
firefox &&
# # Docker - Container Development
# # Untested with Bir Sur NOV2020
# brew cask install docker &&
# brew install docker-compose
# Pass Manager
echo "### Installing Password Manager ###"
brew cask install bitwarden
brew install bitwarden-cli
# brew cask install lastpass
# brew install lastpass-cli
# Text Editor
echo "### Installing Text Editor ###"
brew cask install visual-studio-code
# atom \
# sublime-text2 \
# visual-studio-code
# # Hypervisor (free) -
echo "### Installing Virtualbox ###"
# # Untested with Big Sur NOV2020
# brew cask install virtualbox
# Fonts
echo "### Installing Font(s) ###"
brew tap homebrew/cask-fonts
brew cask install font-fira-code
# SSH Setup
echo "Setting up SSH ###"
mkdir ~/.ssh && touch ~/.ssh/config
cat << EOF >> ~/.ssh/config
Host <SHORTNAME>
HostName x.x.x.x
User <USER>
#Port XXXX
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/<YOUR_KEY>
EOF
# macOS Interface Tweaks
echo "Performing macOS Interface Tweaks ###"
# Show Library folder
chflags nohidden ~/Library
# Show hidden files
defaults write com.apple.finder AppleShowAllFiles YES
# Show path bar
defaults write com.apple.finder ShowPathbar -bool true
# Show status bar
defaults write com.apple.finder ShowStatusBar -bool true
# Save screenshots to a folder on the desktop
mkdir ~/Desktop/screenshots
defaults write com.apple.screencapture location ~/Desktop/screenshots

Setting up a new mac

Requirements

  1. Install Package Manager
  • /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  1. Update brew:
  • brew update

Install Script

There's a script for all most of the things.

  1. Inspect and comment out / replace the programs you don't want. This starting point.
  2. Execute the install script by copying and running the script in this gist: sh ./macos-setup.sh

Post-Install Steps

Fix Bash Shell and set as Default

In the install script you got an updated version of the bash shell. Now make that the default:

  1. Edit the shells file: sudo vim /etc/shells
  2. Append the file with a new line: /usr/local/bin/bash and save.
  3. Change to this new shell: chsh -s /usr/local/bin/bash.
  4. Restart your terminal emulator (iterm2)

Note: /usr/local/bin/bash: new version for use in scripts

Browser Extensions

I use the following browser extensions:

  • gitako
  • dark reader
  • bitwarden
  • momentum

iTerm2

  1. Preferences > Profiles > Colors: set theme to "Pastel Dark Background"
  2. Preferences > Profiles > Text: set font to Fira Code 14 pt
  3. Preferences > Profiles > Session.
  • Turn on Status bar enabled
  • Then click Configure Status Bar to begin setting up your status bar configuration.

reference

System Settings

To get the Home folder in the finder, press CMD + SHIFT + H and drag the home folder to the sidebar.

General

  • Set Dark mode
  • Make Firefox default browser

Dock

  • Automatically hide and show Dock
  • Show indicators for open applications
  • Use scale effect

Keyboard

  • Key Repeat -> Fast
  • Delay Until Repeat -> Short
  • Disable "Correct spelling automatically"
  • Disable "Capitalize words automatically"
  • Disable "Add period with double-space"
  • Disable "Use smart quotes and dashes"

Security and Privacy

  • Allow apps downloaded from App Store and identified developers
  • Turn FileVault On (? never done this, bad cyber guy bad!)
  • Turn Firewall On

Sharing

  • Change computer name
  • Make sure all file sharing is disabled

Users & Groups

  • Add "Rectangle" to Login items
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment