Skip to content

Instantly share code, notes, and snippets.

@pycoder2000
Last active September 18, 2024 06:25
Show Gist options
  • Save pycoder2000/d215e27bb5ec6b17c9658d3467034ffe to your computer and use it in GitHub Desktop.
Save pycoder2000/d215e27bb5ec6b17c9658d3467034ffe to your computer and use it in GitHub Desktop.
My MacOS setup instructions and commands

Setup Mac OS X


1. Install homebrew

# Install zsh
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.bash)"

# Check it's installed properly
brew doctor

# Update once just to confirm
brew update

At the end of the installation, don't quit. There'll be 2 more steps mentioned that you need to complete.

(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/parthdesai/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

2. Install Oh My Zsh

Run this to confirm that zsh is installed

zsh --version

Install zsh

brew install zsh

Set zsh as your default shell

chsh -s $(which zsh)

Check that zsh is your default shell

echo $0
# Should return: zsh
which zsh
# Should return: /usr/local/bin/zsh

3. Setup powerlevel10k theme

First install the MesloLGS NF font.

brew install powerlevel10k
echo "source $(brew --prefix)/share/powerlevel10k/powerlevel10k.zsh-theme" >>~/.zshrc

Make sure you change the font in terminal and VS Code (terminal.integrated.fontFamily)

4. Install zsh plugins

Both of these can be done with Homebrew

  1. Install zsh-syntax-highlighting
  2. Install zsh-autosuggestions

Your plugins will look like this.

plugins=(
    git
    zsh-syntax-highlighting
    zsh-autosuggestions
)

5. Install brew apps

brew install git node yarn blueutil virtualenv
brew install --cask vlc

6. Install python

# Install python
brew install python

# List all python installations
brew list python

# List all python dependencies
brew deps python

# When you want to upgrade python
brew upgrade python

# Check pip installation
pip --help

Your .zprofile should look like this after this point

eval "$(/opt/homebrew/bin/brew shellenv)"
export PATH="$(brew --prefix python)/libexec/bin:$PATH"

7. Add aliases and functions

Add this to the .zshrc file

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

if [ -f ~/.bash_functions ]; then
    . ~/.bash_functions
fi

This is the bash_aliases file and bash_functions file.

8. Configure git

git config --global user.name "Parth Desai"
git config --global user.email "desaiparth2000@gmail.com"
git config --global github.user pycoder2000
git config --global color.ui true

Generate SSH keys

ssh-keygen -t rsa

Copy SSH key to clipboard

pbcopy < ~/.ssh/id_rsa.pub

Put SSH key in Github

9. Modify OSX Settings

⚠️ Quit system preferences before running any of these commands

i. General UI/UX

# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true

# Expand print panel by default
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true

# Save to disk (not to iCloud) by default
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false

# Disable the “Are you sure you want to open this application?” dialog
defaults write com.apple.LaunchServices LSQuarantine -bool false

# Disable auto-correct
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false

# Remove global for ApplePressAndHoldEnabled
defaults delete -g ApplePressAndHoldEnabled

# Disable press and hold for VSCode
defaults write com.microsoft.vscode ApplePressAndHoldEnabled -bool false

#Set a blazingly fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 1

#Set a shorter Delay until key repeat
defaults write NSGlobalDomain InitialKeyRepeat -int 10

ii. Finder

# Finder: show all filename extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true

# Finder: show status bar
defaults write com.apple.finder ShowStatusBar -bool true

# Finder: show path bar
defaults write com.apple.finder ShowPathbar -bool true

# Finder: allow text selection in Quick Look
defaults write com.apple.finder QLEnableTextSelection -bool true

# Disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false

# 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

# Use list view in all Finder windows by default
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"

# Disable the warning before emptying the Trash
defaults write com.apple.finder WarnOnEmptyTrash -bool false

# Enable snap-to-grid for icons on the desktop and in other icon views
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist

iii. Screen

# Save screenshots to the Screenshots folder
defaults write com.apple.screencapture location -string "${HOME}/Pictures/Screenshots"

# Disable thumbnail after capturing a screenshot
defaults write com.apple.screencapture show-thumbnail -bool false

# Disable shadow in screenshots
defaults write com.apple.screencapture disable-shadow -bool true

iv. Address Book, Dashboard, iCal, TextEdit, TrackPad and Disk Utility

# Use plain text mode for new TextEdit documents
defaults write com.apple.TextEdit RichText -int 0

# Open and save files as UTF-8 in TextEdit
defaults write com.apple.TextEdit PlainTextEncoding -int 4
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4

# Tap to click in the trackpad
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1

# Disable accent keys option
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false

v. Time Machine

# Prevent Time Machine from prompting to use new hard drives as backup volume
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true

vi. Dock, Dashboard, and hot corners

# Hot corners
# Possible values:
#  0: no-op
#  2: Mission Control
#  3: Show application windows
#  4: Desktop
#  5: Start screen saver
#  6: Disable screen saver
#  7: Dashboard
# 10: Put display to sleep
# 11: Launchpad
# 12: Notification Center
# 13: Lock Screen

# Top left screen corner → Launchpad
defaults write com.apple.dock wvous-tl-corner -int 11
defaults write com.apple.dock wvous-tl-modifier -int 0

# Top right screen corner → Mission Control
defaults write com.apple.dock wvous-tr-corner -int 2
defaults write com.apple.dock wvous-tr-modifier -int 0

# Bottom left screen corner → Show application windows
defaults write com.apple.dock wvous-bl-corner -int 3
defaults write com.apple.dock wvous-bl-modifier -int 0

# Bottom right screen corner → Desktop
defaults write com.apple.dock wvous-br-corner -int 4
defaults write com.apple.dock wvous-br-modifier -int 0

# Put dock on the left
defaults write com.apple.dock orientation -string left

# Disable dock magnification
defaults write com.apple.dock magnification -bool false

vii. Terminal & iTerm 2

# Disable the annoying line marks
defaults write com.apple.Terminal ShowLineMarks -int 0

# Don’t display the annoying prompt when quitting iTerm
defaults write com.googlecode.iterm2 PromptOnQuit -bool false

viii. Disable MacOS gatekeeper

🛑 Be very careful before running any of these commands

sudo spctl --master-disable
sudo defaults write /var/db/SystemPolicy-prefs.plist enabled -string no
defaults write com.apple.LaunchServices LSQuarantine -bool false

ix. Setup sudo with fingerprint

curl -fsSL https://gist.githubusercontent.com/vraravam/0579373b2028e9b5b08ae87fb39c09d8/raw | bash

x. Remove an app from quaratine

sudo xattr -rd com.apple.quarantine /Applications/FiveNotes.app
sudo xattr -cr /Applications/FiveNotes.app

10. Install necessary apps

AltTab.app
AppCleaner.app
Blip.app
Cleaner-App.app
Dozer.app
Dropzone 4.app
Kap.app
MacUpdater.app
Microsoft Edge.app
Microsoft Excel.app
Microsoft Outlook.app
Microsoft PowerPoint.app
Microsoft To Do.app
Microsoft Word.app
Notion.app
PanWriter.app
Plume.app
Raycast.app
Rectangle.app
Safari.app
Soduto.app
VLC.app
Visual Studio Code.app
iTerm.app
zoom.us.app

11. Manual Settings

  • Appearance --> Dark Mode
  • Sidebar icon size --> Medium
  • Show scroll bars --> Automatically based on mouse or trackpad
  • Control Center --> Bluetooth --> Show in Menu Bar
  • Battery --> Show percentage
  • Siri --> Don't show in Menu Bar
  • Time Machine --> Don't show in Menu Bar
  • Automatically hide and show the Dock --> On
  • Default web browser --> Microsoft Edge
  • Automatically rearrange Spaces based on most recent use --> On
  • When switching to an application, switch to a Space with open windows for the application --> On
  • Group windows by application --> On
  • Displays have separate Spaces --> On
  • True tone --> Off
  • Save picture of screen as a file --> Shift + F2
  • Copy picture of screen to the clipboard --> Shift + F3
  • Save picture of selected area as a file --> Shift + F5
  • Copy picture of selected area to the clipboard --> Shift + F4
  • Screenshot and recording options --> Shift + F6
  • Swipe between pages --> Scroll left or right with two fingers
  • Swipe between full-screen appss --> Swipe left or right with three fingers
  • Mission Control --> Swipe up with three fingers
  • Launchpad --> Pinch with thumb and three fingers
  • Show Desktop --> Spread with thumb and three fingers
  • Secondary click --> Click or tap with two fingers
  • Tap to click --> Tap with one finger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment