Skip to content

Instantly share code, notes, and snippets.

@gabrieljoelc
Last active September 28, 2022 20:13
Show Gist options
  • Save gabrieljoelc/72e2c38a6fb3f9bd3899fbe4e5971a7d to your computer and use it in GitHub Desktop.
Save gabrieljoelc/72e2c38a6fb3f9bd3899fbe4e5971a7d to your computer and use it in GitHub Desktop.
Gabe's Mac Setup Checklist - since I can't dockerize my host :(
# add to home directory
# git config --global core.excludesfile ~/.gitignore_global
# ignore vim swap files
*.swp
# add to home directory
# see https://sanctum.geek.nz/arabesque/vi-mode-in-tmux/
set-window-option -g mode-keys vi
# https://www.johnhawthorn.com/2012/09/vi-escape-delays/
set -s escape-time 0
# after brew install reattach-to-user-namespace. see https://robots.thoughtbot.com/how-to-copy-and-paste-with-tmux-on-mac-os-x
set-option -g default-command "reattach-to-user-namespace -l zsh"
# https://unix.stackexchange.com/a/35932/275026
# Start windows and panes at 1, not 0
set -g base-index 1
setw -g pane-base-index 1
# Mouse based copy see https://github.com/tmux/tmux/issues/913
# bind-key -T copy-mode MouseDragEnd1Pane send -X copy-pipe-and-cancel "reattach-to-user-namespace"
# copy mode copy to system buffer
# combined https://github.com/tmux/tmux/issues/909#issuecomment-300029255 and https://github.com/tmux/tmux/issues/909#issuecomment-302284332
#bind -T copy-mode-vi y send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" \; display-message "copied to system clipboard"
# copy mode copy to system buffer. see https://unix.stackexchange.com/a/406909
#bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'reattach-to-user-namespace pbcopy'
#bind-key -T copy-mode-vi V send-keys -X rectangle-toggle
#bind-key -T copy-mode-vi Y send-keys -X copy-end-of-line

MVP Setup

Initital

  1. Install Spectacle
  2. Increase keyboard repeat to "Fast" and "Delay Until Repeat" to "Short" in Keyboard preferences
  3. Install XCode developer tools
    xcode-select --install
    
  4. Install Homebrew

Git setup

  1. Install git
    brew install git
    
  2. Install Keybase
    brew install keybase
    # will need a 2-factor device to create add device to Kebyase
    keybase login
    
  3. Configure keybase.io GPG key to sign git commits
    1. Create computer-specific password manager folder with namespace like: gabes-macbookpro15-2015
    2. Add new SSH key passphrase to computer-specific password manager folder - use this passphrase for below
    3. https://github.com/pstadler/keybase-gpg-github
      1. For some reason when I ran the keybase pgp gen --multi command (this step) it didn't actual import the new key into GPG. I had to walk through the steps in https://www.keybits.net/post/import-keybase-private-key to manually import the newly generated key
      2. When I delete the key from Keybase and locally and retried. It worked the first time. I think it was because I took too long on the first pass to enter the passphrase.
    4. A commit didn't work the first time. Found this comment for the fix.
    5. To add passphrase to keychain, use this comment but with this to replace the second line of the script echo "pinentry-program /opt/homebrew/bin/pinentry-mac" >> ~/.gnupg/gpg-agent.conf
    6. Old notes for adding passphrase to keychain:
      1. Using https://phillipgreenii.github.io/signing-commits-on-github-with-keybaseio/ to store the passphrase in the keychain so GPG will stop prompting with "Please enter the passphrase to unlock the openpgp secret"
        1. Lead me to https://gist.github.com/bmhatfield/cc21ec0a3a2df963bffa3c1f884b676b
        2. Also lead to https://www.ahmadnassri.com/blog/github-gpg-keybase-pgp/
      2. Ensure you do the "optional" tty step
  4. Create SSH key
    1. ssh-keygen
    2. Add new SSH key passphrase to computer-specific password manager folder
    3. Add private key to macOS keychain: ssh-add -K ~/.ssh/id_rsa

Shell setup

  1. Install Oh My Zsh
  2. Install Tomorrow Night Eighties
  3. Configure Oh My Zsh plugins
    1. docker
    2. docker-compose
    3. osx
    4. vi-mode

Tmux setup

  1. Install tmux (see good reference)
    brew install tmux
    
  2. Mac OS X pasteboard library: brew install reattach-to-user-namespace
  3. Copy .tmux.conf from here

Mac apps

  1. Install Slack
  2. Install MightyText

Vim setup

  1. brew install vim - because macOS doesn't include clipboard out-of-the-box
  2. Install Ctrl-P
  3. brew install the_silver_searcher
  4. Install vim searching https://robots.thoughtbot.com/faster-grepping-in-vim (see also here for reference)
  5. Copy in .vimrc from here

Dev environment setup

  1. Install Docker for Mac
  2. Install rbenv (optional)
    1. Based on https://blog.metova.com/choosing-a-ruby-version-management-tool and http://jonathan-jackson.net/rvm-and-rbenv, rbenv is lighterweight which is what I want if I'm going to try and use Docker for everything and use orats.
  3. For ruby environment issues including Macbook M1 issues: rbenv/rbenv#1267 (comment)

Nice to haves

  1. Install tree
    brew install tree
    

Windows / Boot Camp / Bootcamp

It's spelled "Boot Camp" in macOS and "Bootcamp" in Windows for some reason. ¯_(ツ)_/¯

macOS

  1. Download Windows 10 iso
  2. Open Boot Camp Assistant
  3. Select iso path
  4. Select at least 100 GB (Visual Studio development takes a lot of space)

Windows 10 Installation

  1. Select Windows 10 Home

Windows 10 Trackpad Setup (including right-click)

From https://superuser.com/a/644551/222702:

  1. Open Control Panel
  2. Go to "Control Panel". Click on the phrase "System and Security". Then "Boot Camp". Click on the "Trackpad" tab. In the "One Finger" area, enable the checkbox next to "Secondary Click". Click OK.

Choosing where to boot from

Restart computer in either OS and hold down the Option key to choose boot up partition.

Quest for perfect note taking

Here are my requirements:

  • GitHub style Markdown
  • Live preview
  • vim keystrokes

Current: I'm trying https://github.com/shime/livedown because it had the simplest documentation compared to the many others.

Future ideas:

  • Auto synching to gist or a GitHub repo (done)
  • Ability to migrate to Google Docs
  • Ability to convert to a Inbox by Google email
# add to ~/.oh-my-zsh/custom
alias d="docker"
alias dc="docker-compose"
alias dcu="dc up"
alias dcub="dcu --build"
alias dcr="dc run --rm"
alias dce="dc exec"
# add to ~/.oh-my-zsh/custom
# see https://github.com/pstadler/keybase-gpg-github#optional-setting-up-tty
GPG_TTY=$(tty)
export GPG_TTY
# add to ~/.oh-my-zsh/custom
alias h="heroku"
alias hr="heroku run"
alias hrr="hr rails c --app"
alias hc="heroku config --app"
# add to ~/.oh-my-zsh/custom
# see https://stratus3d.com/blog/2017/10/26/better-vi-mode-in-zshell/
EDITOR=vim
# Easier, more vim-like editor opening
bindkey -M vicmd v edit-command-line
# `v` is already mapped to visual mode, so we need to use a different key to
# open Vim
bindkey -M vicmd "^V" edit-command-line
# reduce delay to trigger zsh vi mode https://dougblack.io/words/zsh-vi-mode.html and https://www.johnhawthorn.com/2012/09/vi-escape-delays/
export KEYTIMEOUT=1
# need this for homebrew vim (see https://apple.stackexchange.com/a/252436/93164)
export EDITOR="/usr/local/bin/vim:$PATH"

Development Setup

  1. Install Visual Studio Community
    1. Include:
      • ASP.NET and web development
      • Data storage and processing
      • Include C++ runtime that SQL Server requires (not sure which one. I included Desktop development which worked, so something in there)
  2. Install SQL Server 2017 Developer Edition
  3. Install SSMS

Docker for Linux Subsystem

sudo apt-get install zsh
sudo apt-get install git-all
  • Went with Full Download to get all unix commands
  • Failed to execute when in "Program Files". Found this issue. Moved to c:/dev

zsh

Apps

  1. Install Docker
    • Received an error
  2. Install Slack
    • Tried installing through Microsoft Store but got an error
    • Downloaded beta from website instead

Didn't need this after all. I forgot to install SQL Server

No server showing up in login

  1. Relevant StackOverflow answer
    1. SQL Server Configuration Manager error

      Cannot connect to WMI provider. You do not have permission or the server is unreachable.

      1. Found this and it worked:
      # command prompt
      mofcomp "%programfiles(x86)%\Microsoft SQL Server\140\Shared\sqlmgmproviderxpsp2up.mof"
      
      1. SQL Server Services did not have any servers so I abondoned this StackOverflow solution
  2. Instead, I uninstalled SSMS
  3. Executed VS 2017 installer
    1. Included "Data storage and processing" which includes "SQL Server Data Tools" (I think)
  4. Restarted computer
  5. This didn't work either...
  6. Uninstalled SSMS and VS 2017
  7. Restarted computer
  8. Installed VS
  9. Restarted computer I ended up deleting the Boot Camp partition and reinstalling Windows. I installed Visual Studio 2017 Community and included SQL Server Data Tools. However, no SQL Server services was showing up in Services.

Based on this support doc, I am wondering if I got this working before because I restore a SQL Server bak file. However, I really thought that the Server drop down had a listing of a server before.

I just finished installing SSMS again and am getting the same error when trying to open SQL Server Configuration Manager... starting over in this section...

I am actually thinking now that it's because I need install SQL Server itself.

  1. Downloaded SQL Server 2017 Developer Edition
  2. Received installation error

    Visual Studio runtime "Microsoft Visual C++ 2017 x64 Minimum Runtime - 14.11.25325" needs to be repaired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment