Home

My  macOS development setup

July 15, 2018

Introduction

I’ve recently acquired the new 15 inch Macbook Pro. Despite the UselessBar, I’ve been in love with it mainly because it’s light and thin and black. And also coming from a mechanical keyboard “background”, I actually really like the feely of the new Butterfly keyboard.

However, this post is not going to be about how I love my new machine, but rather how I set it up for iOS and Golang development. Many people have asked me about my setup, especially on my terminal setup. Thus, I’ll try to document everything in this post, and also try to keep it always up-to-date.

Homebrew

The very first thing I do is to install Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Fish shell 🐡

My setup is going to be heavily relies on the shell, so let’s get Terminal ready.

I’ve switched from zsh to fish shell for almost 2 years. And I feel like that fish although not as powerful as zsh, but it provides me with enough functionalities out of the box, and it requires very minimal configurations.

Installing fish

brew install fish
echo /usr/local/bin/fish | sudo tee -a /etc/shells
chsh -s /usr/local/bin/fish
fisher 

Restoring the dotfiles

Now that I have fish in order, time to restore my beloved dotfiles. My dotfiles mostly contains my Neovim, Tmux, some Fish’s custom functions.

I use the bare repo Git technique to manage my dotfiles. The method is described in detail on Atlassian’s blog

alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
echo ".cfg" >> .gitignore
git clone --bare https://github.com/khoi/dotfiles.git $HOME/.cfg  
config checkout

Some macOS tweak

Install brew’s packages 🍺

brew install aria2
brew install mas
brew install tldr
brew install youtube-dl
brew install neovim
brew install git 
brew install openssl
brew install reattach-to-user-namespace # Use for tmux
brew install ripgrep
brew install tmux
brew install hub 
brew install fd
brew install go
brew install jq
brew install node
brew install khoi/tap/compass
brew install htop
brew install ffmpeg
brew install m-cli
brew install fzf && /usr/local/opt/fzf/install

Install AppStore application with mas

mas lucky 1Password
mas lucky moom
mas lucky telegram
mas lucky “The Unarchiver”
mas lucky xcode

Install applications using brew cask

The ability to installing, maintaining, and removing apps using brew cask makes I feel like a super hero. This is my preferred way of installing software.

brew cask install visual-studio-code
brew cask install gpg-suite-no-mail
brew cask install google-chrome
brew cask install dash
brew cask install alfred
brew cask install charles 
brew cask install adguard 
brew cask install jetbrains-toolbox 
brew cask install docker
brew cask install private-internet-access
brew cask install caskroom/fonts/font-hack 
brew cask install font-fira-code 
brew cask install vlc
brew cask install 1password-cli

Restore private keys

I stored my private keys, environment variables in 1Password.

set -x OP_SESSION_my (op signin https://my.1password.com khoiracle@gmail.com --output=raw)
op get document id_rsa > ~/.ssh/id_rsa
op get document id_rsa.pub > ~/.ssh/id_rsa.pub
chmod 0600 ~/.ssh/id_rsa

op get document GPG > 1.asc
gpg --import 1.asc
rm 1.asc

Miscs

Conclusion

Overall, I’m really happy with the setup above. One thing I need to figure out is how to make use of this fancy-yet-useless TouchBar. Also I’ll probably go in to detail on how I use my shell with fish + tmux + neovim in another blog post. Stay tuned 🙇‍♂️.