So, now that I’ve got my initial dotfiles sync setup done on Mac, it’s time to try porting it over to WSL! You might notice this is a super short snippet of a post, which in this case is a good thing. Homebrew is able to run on linux, so I just needed to follow these instructions to get it running. Since I also wanted to use my same set of dotfiles cross platform, I did need to make a few small changes to those.

First, in my .zshrc I needed to alias brew to the linux install when the operating system is linux. I added the lines below to achieve this.

if [[ $OSTYPE == "gnu-linux" ]]; then
        eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
fi

Other than that I did need to update a few aliases to no longer reference file paths specifically and instead use $HOME which, since we’re on linux, works well enough.

What about files that are for Mac specific apps? I mentioned using iTerm scripting in my first post, and I do version control those scripts. How should I ignore them on platforms that don’t need to be concerned with them?

For these files I ran git update-index --assume-unchanged and then deleted the local file. This is pretty manual still, but there are very few incompatible files that I needed to run it for. I’ll probably try to automate things a bit more in the next part when we move to Windows!

This post is also available on DEV.