I drift between Ubuntu and macOS as my development environment. My most recent stretch of time with the latter caused me to document what I could do to make it more pleasant and productive.


For macOS, Homebrew is a good substitute for package managers, such as apt, that you would find in most Linux systems. For example, I have the following tools and utilities installed at this moment:

$ brew list
composer    libyaml     pdftohtml   readline    vim  
ctags       makedepend  perl        redis  
gdbm        mongodb     pkg-config  ruby  
git-flow    openssl     python      sqlite  

In Ubuntu via apt, I can also install any program, including applications that have a gui, such as Skype, Slack, and Spotify. On macOS, I can do this with Homebrew-Cask. I have a few applications installed this way as well.

$ brew cask list
skype               vagrant             virtualbox          zoomus  

For terminal usage, I have iTerm installed. I have enabled features such as infinite scroll back to emulate what I am accustomed to in Gnome Terminal.


There are a couple of things that I do for my bash setup in macOS to make it a little friendlier.

# Excerpt from .bash_profile
alias ls="ls -G" # Pretty listings in iTerm, like color-coded types  
source ~/git-completion.bash # Git autocompletion  

The second item, Git autocompletion, comes for free when you install git using apt on Ubuntu, but I found I had to explicitly source it for macOS.


Also for my Git workflow, I like to set up a tool for handling merges and diffing. On Ubuntu, I use meld, which is already an allowed mergetool in git. However, in order to use my preferred tool on macOS, deltawalker, I add the following changes to .gitconfig:

[diff]
    external = "/Applications/DeltaWalker.app/Contents/Resources/git-diff"
[merge]
    tool = deltawalker
[mergetool "deltawalker"]
    cmd = '/Applications/DeltaWalker.app/Contents/Resources/git-merge' "$LOCAL" "$REMOTE" "$BASE" "$MERGED"

There are also a couple of things I add to my vim configuration for macOS.

" Excerpt from .vimrc
" Map alternate key combination for Esc.
noremap <c-[> <Esc>  
" Map arrow keys for nomal mode.
nnoremap <silent> <Esc><Up>A <Nop>  
nnoremap <silent> <Esc><Down>B <Nop>  
nnoremap <silent> <Esc><Right>C <Nop>  
nnoremap <silent> <Esc><Left>D <Nop>  

As you may have guessed, I find myself working on a 2016 MacBook Pro, with the dynamic touch capacitive function key strip. So I am without a physical escape key to feel by touch. So, I map Ctrl-[ to switch to normal mode, but consequently have to remap the arrow keys so that they work normally as a result (due to some side effect of the first mapping rule, still not entirely clear to me).


For good windows management keystrokes, similar to what I use in Ubuntu 17.10, or in any Gnome based shell, I found that Magnet is up to the task. I like to spend as little of my day as possible dragging windows around, so this has been a nice find. It is best to install it from the app store, I did not find any package available under brew cask.


That's all I've needed to do so far to allow macOS to be a decent place to spend my time as an engineer. If I find that I need to add anything else to my setup, I'll likely document here. I switch between development platforms enough that it's good to have a reminder sometimes.