Published on

.dotfiles

Authors
  • avatar
    Name
    Thomas Quan
Reading time

Reading time

6 min read

.dotfiles and ricings

In this blog post, I'd like to walk you through how I manage my dotfiles, along with some slick ricing setups I use on my macOS. If you like what I setup, feel free to take a look at the github repo to pick and choose your setup config or follow the entire config itself via install.sh

What are Dotfiles anyway?

Funny enough, dotfiles are files that you have come across a lot during your time developing. Dotfiles in it self are configuration files used to personalize your UNIX-like environment. They're called "dotfiles" because they typically start with a dot (.) like .bashrc, .gitconfig, .zshrc, .vimrc, etc.

These files store settings and preferences for your shell, terminal, development tools, and more.

💬 Think of dotfiles as your game settings. You tweak them once to your liking, and they stay that way every time you "play" (open your terminal, run a command, or code something).

Why Should You Care?

If you're only working on one machine, yeah...maybe you don’t. But as soon as you start having multiple setup (one for work, one for gaming...etc) or having to migrate new system often. Things start to add up and get a bit messy to handle. This is where it becomes essentinal to set this up as a one time pain and enjoy the breeze later.

Plus, dotfiles is a good way for you to keep yourself organize, nobody wants to have their files and junks laying around at their desk, do they? Right?


Managing the dotfiles the smart way

These files are scattered across different folders depending on the config file you setup. Some live in the home directory ~, or in the ~/.config folder. Remembering them is difficult if you don't have the right tools and command to do so. So what if we could disregard all that process all together and have 1 dedicate folder to handle of that for us.

My setup revolves around that theory and involve two core tools: git and symlinks.

  • Git for cloud storage and versioning.
  • Symlinks for handling the config structure in the system.

The way I set it up is that I create a ~/dotfiles folder that store act as a mirror for my root folder and stores all my configurations. Then, I use stow which is a popular tools to handle symlinks to mirror the effects within the dotfiles across my system.

If you're not familiar with symlinks, I recommend reading about it here Understanding Symlinks and a Common Use Case for Linux

With that, all I need to do is the following:

  1. Create a dotfiles folder:
  2. Migrate my configuration there with mv
  3. Use Stow as a Symlink Manager declare within dotfiles folder to mirror the root folder via stow .

And Voila!, we have a working dotfiles ready and sync-able

All we need to do here is edit the config in their respective file and navigate to dotfiles folder to sync them when ready.

All config now in one - it is time for ricing 🍚

Somethings cooking The only issue now is that every time I set up a new device, I need to get all my installations up and running again to make use of my configuration. But I’ll deal with that later for now, Let's just enjoy our sweet sanity levels dropping and thought I’d share my rice config with you all.

For almost 5 years now, I'm been trying to get into the world of Linux and Ricing but have never gotten the chance to do so, mostly side-tracked with studying and job hutting and working, and even with work, most of the machine I get is a Mac and mac at the time was not very friendly and ❄️cool❄️ to say the least. But with the introduction of the M1 chip, everything chance, everything was possible now and the only thing at the time that was missing for me was - time. But oh boy... now I have a load of time for me to play around with and ricing was the first thing that came into my mind.

Countless hours spend figuring out the best fonts, best layouts, best setup, and we can't forget about wallpaper now is up in github and reproducable throughout my machines (Mac for now, (fk WSL)).


Now I have this, the setup I'm running at the moments can be found in the repo above itself or tldr:

  • Aerospace for MacOS
  • Wezterm
  • ZSH
  • Neovim
  • Custom Tokyonight Color Theme
  • Sketchybar for MacOS

Ricing 1 Ricing 2 Ricing 3

Back to the boring stuffs, automating with install script.

Now that we got all our config ready and setup for usage and syncing. We need a way to automate the syncing process in our new machine somehow.

This is a murky water territory, where you can have multiple ways of settings it up. Ranging from basic paper pen, to complex Nix setup and install via curl link...etc

For my side, I've tried both, and honestly neither is ideal for most people I would think. Manual setup require times inputing down one by one the downloads you want. Nix require a steep learning curve which doesn't justify for the basic requirement I have.

My preferred middle ground is to use a simple shell script to automate system setup, which proves to be the bread and butter for most peoples

To get started with install.sh, you can get started with basic command added into the script and build it up from there

The way I set it up right now is (still a work in process for MacOS):

#!/bin/bash

echo "Seeding"

# Install xCode cli tools
echo "Installing commandline tools..."
xcode-select --install

# Essentials
brew install lua
brew install sketchybar --cask FelixKratz/formulae
brew install wezterm
brew install borders
brew install --cask nikitabobko/tap/aerospace

# Terminal
brew install neovim
brew install zoxide
brew install eza
brew install starship

# Fonts
brew install --cask sf-symbols
brew install --cask homebrew/cask-fonts/font-sf-mono
brew install --cask homebrew/cask-fonts/font-sf-pro
brew install --cask font-fira-code-nerd-font

curl -L https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v2.0.25/sketchybar-app-font.ttf -o $HOME/Library/Fonts/sketchybar-app-font.ttf

# Start Services
echo "Starting Services (grant permissions)..."
brew services start sketchybar
brew services start borders

With that, all you need to do is make sure you have brew yourself and fire the bash script away.

📘 My dotfiles come with a submodule repo with neovim setup so I have a separate repo handling that here

Should you try it?

I say go ahead and try it, start early and you would be surprise how handy it can once you start using it. Things start to click easier, folders start to get more organize. Like all programmer said, it is all about ✨productivity✨


And at the end of the days, having the ability to save your 100 hours work of ricing is what is important. I mean look at how beautiful this MacOS rice is, I can't imagine the day, where I lose all this config and have to search and re-config all of them.