Skip to content

usman1515/MacOS_Setup

Repository files navigation

MacOS Setup

Table of Contents

Introduction

This repo is designed for anyone who is moving from Linux to MacOS for the 1st time. The reason for the switch is simply because of the new Apple Silicon that is being offered. I still pretty much will be using my Linux workflow and tools on the Mac. This guide simply eases in the migration of those tools.

The following environment was developed on an Apple MacBook Air M1 running MacOS Monterey (ver 12.5). You can read more about it here.

1. Setting Up System Preferences

As this is a new computer there are a couple tweaks you could make to the System Preferences. These include but aren't limited to:

1.1 General

  • Show scroll bar:
    • Always

1.2 Dock and Menu Bar

  • Dock size: set slider to approx 20%
    • Magnification: set slider to approx 50%.
    • Automatically hide and show the dock.
  • Bluetooth:
    • Show in menu bar
  • Keyboard brightness:
    • Show in menu bar
  • Battery
    • Show percentage.
  • Clock:
    • Show date: Always
    • Display the time with seconds.
  • Spotlight:
    • Show in menu bar.

1.3 Trackpad

  • Point and click

      • Secondary click.
      • Tap to click.
  • Scroll and zoom

      • Scroll direction: Natural
      • Zoom in and out
      • Smart zoom
      • Rotate

1.4 Displays

    • Automatically adjust brightness

Once all this done run he following commands in the terminal.

# Remove workspace auto-switching by running the following command:
defaults write com.apple.dock workspaces-auto-swoosh -bool NO
# Restart the Dock process
killall Dock

# Enable repeating keys by pressing and holding down keys:
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false # (restart any app that you need to repeat keys in)

# Change the default folder for screenshots
# create screenshots folder
mkdir -p ~/Pictures/Screenshots
# Then run the following command
defaults write com.apple.screencapture location ~/Pictures/Screenshots && killall SystemUIServer

2. Setting up the Development Environment

  1. Install xcode and Homebrew:
    source install_homebrew.sh
  2. Install Rosetta:
    /usr/sbin/softwareupdate --install-rosetta --agree-to-license

3. Setting up the Terminal

3.1 Kitty and Alacritty (my favourites)

  1. Install Kitty and Alacritty
    brew install --cask kitty
    brew install --cask alacritty
  2. Install a Nerd font.
    brew tap homebrew/cask-fonts
    
    # my favourite font
    brew install --cask font-caskaydia-cove-nerd-font
    
    # install other fonts (if you want)
    brew install --cask font-anonymous-pro
    brew install --cask font-anonymice-nerd-font
    brew install --cask font-fira-code-nerd-font
    brew install --cask font-iosevka-nerd-font
    brew install --cask font-inconsolata-nerd-font
    brew install --cask font-inconsolata-lgc-nerd-font
    brew install --cask font-inconsolata-go-nerd-font
    brew install --cask font-jetbrains-mono-nerd-font
    brew install --cask font-overpass-nerd-font
    brew install --cask font-roboto-mono-nerd-font
    
    # list all fonts you can install this way
    brew search "/font-/"
  3. Install git:
    brew install git
  4. Clone the dotfiles repo.
    git clone https://github.com/usman1515/dotfiles.git
  5. Copy the git config file .gitconfig into the $HOME directory.
  6. Setup alacritty terminal config using the dotfiles repo.
    # copy config
    cp -rv dotfiles/alacritty ~/.config
    
    # Download themes repo
    git clone https://github.com/alacritty/alacritty-theme ~/.config/alacritty/themes
  7. Setup kitty terminal config using the dotfiles repo.
    # copy config
    cp -rv dotfiles/kitty ~/.config
    
    # setup theme
    kitty +kitten themes

3.2 iTerm2

  1. Install iterm2
    brew install --cask iterm2

3.3 Setting up iTerm2 Preferences

    • Make iTerm2 default term.
  1. General -> selection:
      • Copied text includes trailing new line.
      • Applications in terminal may access clipboard.
  2. Appearance -> General -> Status bar location: bottom
  3. Appearance -> Windows:
      • Show borders around windows.
  4. Appearance -> Tabs:
      • Show tab bar even when there is only one tab.
  5. Profile -> General:
    • Basics -> name: dark_profile1.
    • Basics -> title: Name (Job) -- User.
    • Icon: Built-in icon for current app.
    • working directory:
      • reuse previous sessions directory.
  6. Profile -> Colors:
    • basic colors -> foreground: FFFFFF.
    • cursor colors -> cursor: FFFFFF.
    • cursor colors -> cursor text : FFFFFF.
    • colors presets: tango dark.
  7. Profiles -> Text:
      • blinking cursor.
    • Font -> type: CaskaydiaCove Nerd font Mono Regular.
    • Font -> size: 11.
      • use ligatures.
  8. Profiles -> Window -> Settings for new windows:
    • Style: Normal
    • Space: Space N
  9. Profiles -> Terminal -> Scrollback buffer:
      • unlimited scrollback.
  10. Profiles -> Terminal -> Terminal Emulation:
      • enable mouse reporting.
  11. Profiles -> Sessions:
      • Status bar enabled.
    • Configure status bar:
      • Auto rainbow: Light colors
      • Active components: CPU, RAM, Network.
  12. Keys -> Hotkey -> Create a dedicated hotkey window: Ctrl + ~.

3.4 Add iterm2 in spotlight

  • Goto System Preferences -> Users and Groups -> you user -> Login Items:
    • + -> Applications -> iTerm. Add it.
    • Hide

4. Setting up the SHELLS

4.1 Setup ZSH

  • I use ZSH for everyday usage of the terminal.
  • To setup ZSH run the following script.
    source setup_zsh.sh
  • Copy the zsh config files into the $HOME dir.
  • Source the file: source ~/.zshrc
  • Once complete restart the machine.

4.2 Setup BASH

  • My shell of choice for scripting is BASH.
  • To setup BASH run the following script.
    source setup_bash.sh
  • Copy the bash config files into the $HOME dir.

5. Install Compilers and Toolchains

  • To install various compilers and tool-chains run the following script.
    source install_compilers.sh
  • Following compilers and tool-chains are available.
Compiler Description
git Git version control
gcc GNU GCC and G++ C/C++ compiler
make GNU make compile utility
python 3.10 Python 3.10
openjdk Development kit for Java
scala JVM-based programming language
rust Safe, concurrent, practical language
docker Container environment

6. Install CLI Tools

  • To install various cli tools run the following script.
    source install_brew_formulae.sh
  • Following CLI tools are available.
Tool Description
curl Get file from HTTP, FTP server
wget Internet file retriever
grep GNU grep, egrep and fgrep
sed GNU sed
awk GNU awk utility
fzf Command-line fuzzy finder written in Go
ripgrep Search tool like grep and The Silver Searcher
fd Simple, fast and user-friendly alternative to find
tree Display directories as trees
exa Modern replacement for 'ls'
fortune Infamous electronic fortune-cookie generator
cowsay Configurable talking characters in ASCII art
fastfetch Fast, highly customizable system info script
cmatrix Console Matrix
vim Vi 'workalike' with many additional features
neovim Ambitious Vim-fork focused on extensibility and agility
bat Clone of cat(1) with syntax highlighting and Git integration
tmux Terminal multiplexer
htop Improved top (interactive process viewer)
ncdu NCurses Disk Usage
imagemagick Tools and libraries to manipulate images in many formats
speedtest-cli CLI for https://speedtest.net
youtube-dl Download YouTube videos from the command-line
ranger File Browser

7. Install GUI Tools

  • To install various cli tools run the following script.
    source install_brew_casks.sh
  • Following softwares are available.
Application Description
visual-studio-code Code Editor
sublimetext Text editor for code, markup and prose
alacritty GPU-accelerated terminal emulator
kitty GPU-based terminal emulator
firefox Web Browser
opera Web Browser
joplin Markdown note taking and to-do application
notion App to write, plan, collaborate
google drive Client for the Google Drive storage service
dropbox Client for the Dropbox cloud storage service
slack Team communication and collaboration software
whatsapp Desktop client for whatsapp
discord Voice and text chat software
spotify Music streaming service
vlc Multimedia player
iina Free and open-source media player
qbittorrent Peer to peer Bitorrent client
folx Download manager with a torrent client
anydesk Allows connection to a computer remotely
vnc viewer Remote desktop application
steam Video game digital distribution service
epicgames Video game digital distribution service
keka File archiver
rectangle Move and resize windows
alt-tab Enable Windows-like alt-tab
alfred Application launcher and productivity software
raycast Control your tools with a few keystrokes
gtkwave GTK+ based wave viewer
keycastr Open-source keystroke visualizer
balena etcher Tool to flash OS images to SD cards & USB drives

8. Setup SSH for GitHub/GitLab etc

  • To generate a SSH key run the following script.
    source setup_sshkey.sh

9. Change HostName of PC

  • To change the hostname of the PC via terminal enter the following commands:
    sudo scutil --get HostName
    sudo scutil --set HostName <your_host_name>

10. Setting up Keyboard Shortcuts

  • To create new and change existing keyboard shortcuts goto: System Preferences -> Keyboard -> Shortcuts
  • Some of my shortcut keymappings include:
App Key Mapping
Launchpad Option + Space

11. Basic Configurations

11.1 Setup configs for CLI based tools

To setup configs for various CLi tools including git, neovim, tmux look into the dotfiles repo.

11.2 Sort all apps in Launchpad

defaults write com.apple.dock ResetLaunchPad -bool true; killall Dock

The following command will arrange all MacOS apps on the 1st page and all installed apps on the other pages.

About

How I setup my MacBook Air M1

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages