DotFiles: New Computer Setup Automation
Summary
Using a script to set up a new computer, that is using WSL/Ubuntu, or OSX.
Introduction
Every time I get a new Mac, I update my process for setting up a new mac, and then I let it languish as time passes, until, I get a new computer. My previous post was kept up to date-ish as time went on, but this post is a revision to that one, where instead of focusing on individual commands that I have to remember, focusing on setting up a script that will just set everything up, and then go away.
This was started with my dotfiles updates. As I have multiple computers, my goal was to have all of them have a terminal that was similar enough, that it would not be difficult to move between them. However, I realize that it’s not just shell aliases and shell prompts that need to be kept aligned for this to keep working.
For one thing, I move between Windows, MacOS X, and Ubuntu (Linux) often. On windows, I use WSL, so I use mostly Ubuntu, and then I have several computers that run linux at home, that also use Ubuntu. So between the multiple OSes and the various different purposes, I found that I don’t have a one size fits all script that handles them, until now!
(I’m kidding, if you were hoping that I had a one size fits all script that set up Windows/Ubuntu/OSX for multiple different purposes, I think that would be amazing, but unlikely something I would put much effort into building, as the other issue with the dotfiles and the setups for development is; it’s always changing.
I used to use bash
, now I use zsh
, at one point I had a lot of python setup scripts, and now I use uv
. There are always changes and updates. However I have not given up entirely on this goal. I’m still maintaining dotFiles. I still plan to upate them once every 2-3 years 🙂
Here is the original post.
Setting Up a New Mac for Development
In gitHub I have a repo called, appropriately, “dotFiles”. This is a great place to start if you are also trying to set up a mac for development, just search gitHub for dotFiles, and you will find many, many people who have already tried to help you set up your Mac, just like I’m doing now. There are many flavors of dotFiles, some that are just the shell configurations, and some that attempt to add software and are os specific. Mine are a combination of both, the configuration files are good for multiple zsh shells.
Step 1: Pulling the Repo
The first thing is to pull the dotFiles repository from git. It’s important to decide where to do that from. Some dotFiles (as mine) are designed to be pulled into your home directory. That is not a great place to have a git repository in general, one reason for this is that you will have ~/Documents, ~/Downloads, and other various folders hanging off of that home folder, so it’s not ideal to have that be a gitHub repository. I have experimented with two approaches:
- SymLink: The first is to pull the repository to another folder (say ~/dev/dotFiles), and then symlink the folders to your home directory. This approach benifits from being able to keep the dotFiles in sync with your repository, so changes can continue to be made, and pushed back to the repo, or pulled from another machine. The con of this system is symLinks mean you can’t make a change for any one computer, as it’s in the repo (of course you can create a branch, and manage it that way.)
- Shallow Pull: The second way was to do a shallow pull. In this way you can actually pull it right into your home directory, and then break the connection to your repo. The good is that it’s independent from the repo, so changes can be made, the bad is that you can’t make changes and push it up.
So those are the options I’ve tried, there may be others.
In the end, I ended up going with the Shallow Pull Option, but I do still think the symlink might be the way to go.
cd ~
git clone --depth=1 git@github.com:nycynik/dotFiles.git .dotfiles
rm -rf ./.dotfiles/.git
After pulling the dotfiles, you then remove the .git directory, severing the link to the original repository, and since you have only pulled the most recent files (no history) that is all you need to complete the shallow copy.
As you can see this is being run from the home directory, again, if you opt for the symlink version, you would place it elsewhere, and then symlink the .dotfiles
folder to your home.
cd <somewhere dev files are saved>
git clone git@github.com:nycynik/dotFiles.git
ln -s dotFiles/.dotfiles ~/.dotFiles
Step 2: Run the installation script
As I said, this dotfiles is not just a configuration, but also a setup script. so the next step is to run the script and have it work the magic setup. Here we go!
cd ~
source .dotfiles/setup.sh
The script will then as you a few questions, and begin installing all the things.

The script first detects the OS, it can be wrong, so you also can choose which OS you are running. Next it collects some basic information it uses during the configuration. I would love to expand that at some point to include which development tools you wanted to use.
Finally, the script runs and sets up the environment. It still has some bash configuration in it, but it’s mostly focused on zsh configuration.
It may still be interactive, as some of the setup steps require authentication, but mostly it should run smoothly, and when finished you will see a set of ToDos that you may want to do.

There is also a brew log that should be reviewed as it’s often the case that brew has some nifty suggestions of it’s own. The log is at ${HOME}/.dotfiles/brew_log.log
, this is often the same as ~/.dotfiles/brew_log.log
.
Conclusion
So, in the end this script worked on all three of my setups, WSL, Linux, and OSX. I don’t have much of a setup for actual Windows. There would be a lot of additional work to get that to work. I think the main thing it would have to do is setup WSL 🙂
This script and the combined configuration files are all available in the same git repo.