Skip to content

eferm/dotfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

New Mac Setup Guide

Highly opinionated personal preferences minimum viable setup.

This guide only known to be compatible with MacOS Monterey (version 12) on an M1 Mac.

Table of Contents:

  1. Configure System
    1. Hostname
    2. Terminal
    3. Homebrew
    4. Zsh
    5. Vim
    6. GPG
    7. SSH
    8. Git
    9. Python
    10. Java
    11. Chrome
  2. Configure Themes
    1. Font
    2. Terminal
    3. Zsh
    4. Vim
    5. Sublime Text
    6. Visual Studio Code

Configure System

Hostname (Optional)

Clean up hostname and computer name [apple.stackexchange.com]

  1. Run commands:

    sudo scutil --set HostName <mymac>
    sudo scutil --set LocalHostName <MyMac>
    sudo scutil --set ComputerName <MyMac>
  2. Flush the DNS cache:

    dscacheutil -flushcache
  3. Restart Mac

Terminal

  1. Create a copy of /Applications/Utilities/Terminal.app called Rosetta Terminal.app and set the Open using Rosetta option in Get Info.

Homebrew

  1. Install Homebrew [brew.sh]:

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

    Run the same command also in Rosetta Terminal.

  2. Install packages:

    /opt/homebrew/bin/brew install gnupg pyenv poetry sublime-text visual-studio-code

    In Rosetta Terminal also run:

    /usr/local/bin/brew install pyenv

Zsh

Ref: [scriptingosx.com]

  1. Add the following to ~/.zprofile:

    echo $(arch)
    
    if [ $(arch) = 'i386' ]; then
        eval "$(/usr/local/bin/brew shellenv)"
        export PYENV_ROOT="${HOME}/.pyenv_x86"
    else
        eval "$(/opt/homebrew/bin/brew shellenv)"
    fi
    
    eval "$(pyenv init --path)"
  2. Add the following to ~/.zshrc:

    if type brew &>/dev/null; then
       FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
    fi
    
    fpath+=~/.zfunc
    autoload -Uz compinit && compinit
    zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
    
    setopt PROMPT_SUBST
    
    alias ls='ls -Gp'
    alias l='ls -ohL'
    alias ll='ls -AohL'
    alias lll='ls -AlhO'
    alias b='cd ..'
    alias bb='cd ../..'
    alias bbb='cd ../../..'
    # https://github.com/pyenv/pyenv/issues/106#issuecomment-94921352
    alias brew="env PATH=${PATH//$(pyenv root)\/shims:/} brew"
    
    export LS_COLORS=exfxfeaeBxxehehbadacea
    
    if [ $(arch) = 'i386' ]; then
        export PYENV_ROOT="${HOME}/.pyenv_x86"
    fi
    eval "$(pyenv init -)"
  3. Run commands:

    mkdir ~/.zfunc && poetry completions zsh > ~/.zfunc/_poetry
    chmod -R go-w '/opt/homebrew/share'
    rm -f ~/.zcompdump
  4. Restart Terminal

Vim

  1. Add the following to ~/.vimrc:

    set number
    set t_Co=16
    set re=0
    
    syntax on
  2. Install the vim-plug plugin [GitHub]:

    curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

GPG

Import GPG keys [serverfault.com]

  1. Copy keys and ownertrust files from your backup:

    • username@example.com.pub.asc
    • username@example.com.priv.asc
    • username@example.com.sub_priv.asc
    • ownertrust.txt
  2. Import keys by running commands:

    gpg --import username@example.com.pub.asc
    gpg --import username@example.com.priv.asc
    gpg --import username@example.com.sub_priv.asc
    gpg --import-ownertrust ownertrust.txt
  3. Trust keys by running commands:

    gpg --edit-key username@example.com

    Output:

    > gpg> trust
    > Your decision? 5
    > gpg> quit
    

SSH

Configure SSH keys and agent [github.com]

  1. Generate new SSH key (use corp. email on corp. laptop):

    ssh-keygen -t ed25519 -C "username@example.com"

    Output:

    > ...
    > Enter passphrase (empty for no passphrase): <empty>
    > ...
    
  2. Add your SSH key to the ssh-agent:

    1. Start SSH agent:

      eval "$(ssh-agent -s)"

      Output:

      > Agent pid 12345
      
    2. Run vim ~/.ssh/config and add the following:

      Host *
          AddKeysToAgent yes
          IdentityFile ~/.ssh/id_ed25519
      
    3. Add you SSH private key to the SSH agent:

      ssh-add --apple-use-keychain ~/.ssh/id_ed25519
  3. Add the SSH public key to GitHub:

    1. Copy the key to your clipboard:

      pbcopy < ~/.ssh/id_ed25519.pub
    2. In GitHub → Profile → Settings → SSH and GPG keys, click New SSH key and paste the key.

    3. For corp. emails make sure to also add these to your GitHub account.

Git

  1. Run commands (use corp. email for corp. laptop):

    git config --global user.name "Firstname Lastname"
    git config --global user.email "username@example.com"
    git config --global commit.gpgsign true

Python

  1. Install a default Python dist:

    pyenv install 3.8.13
    pyenv global 3.8.13

    Run the same commands also in Rosetta Terminal.

Java

  1. Install the latest JDK:

    brew install java
  2. Symlink so MacOS can find the JDK [mkyong.com]

    sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk

Chrome

  1. Run command:

    defaults write com.brave.Browser AppleEnableSwipeNavigateWithScrolls -bool FALSE
  2. Restart browser.

Configure Themes

Preference for the Nord Theme.

Font

  1. Download and install Droid Sans Mono Dotted for Powerline.ttf [GitHub]

Terminal

  1. Download and install the Nord.terminal theme [GitHub]

    • Click Default
  2. Change font to Droid Sans Mono Dotted for Powerline:

    • Font Weight: Regular
    • Font Size: 11pt
    • Character Spacing: 1
    • Line Spacing: 0.885

Zsh

  1. Download the agnoster.zsh-theme to ~/.agnoster.zsh-theme [GitHub]

  2. Edit .zshrc and add the following line at the top of the file:

    source $HOME/.agnoster.zsh-theme

Vim

  1. Run vim ~/.vimrc and append the following:

    call plug#begin(expand('~/.vim/plugged'))
    Plug 'arcticicestudio/nord-vim'
    call plug#end()
    
    colorscheme nord
  2. Still in vim run: :PlugInstall

  3. Save and exit vim

Sublime Text

  1. Run Shift+Cmd+P → Install Package → Nord

  2. Run Shift+Cmd+P → Preferences: Settings, and add:

    "theme": "Adaptive.sublime-theme",
    "color_scheme": "Nord.sublime-color-scheme",
    "font_face": "Droid Sans Mono Dotted for Powerline",
    "font_size": 12,
    "line_numbers": true,

Visual Studio Code

  1. Install the Nord Deep extension

  2. Run Shift+Cmd+P → Open Settings (JSON), and add:

    "workbench.colorTheme": "Nord Deep",
    "editor.fontFamily": "Droid Sans Mono Dotted for Powerline",
    "editor.fontSize": 12,
    "editor.fontLigatures": true,
    "terminal.integrated.fontFamily": "Droid Sans Mono Dotted for Powerline",
    "terminal.integrated.fontSize": 12,
    "terminal.integrated.profiles.osx": {
       "zsh": {"path": "/bin/zsh", "args": ["-c", "/bin/zsh"]}
    },

About

.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published