How to Customise Your Mac Using Dot Files

There are many ways to customise your Mac and now thanks to GitHub other Mac users have shared their valuable dotfiles which show how you can change your Mac to perform a certain task, or look a certain way.

I’m not sure whether my method below is the most correct way for getting this to work, but here’s how I enabled some of my favourite features from Mathias Bynens’ Mac dotfile:

  1. Open up Terminal (or your favourite text editor) and navigate to your home directory:
$ cd ~
  1. Create a new dotfile:
$ touch .osx
  1. Open the newly created dotfile and copy and paste your favourite snippets into this file (you can pick and choose whatever you want)
$ nano .osx
  1. Once you’ve finished, save and close the file.

  2. Now open up your .bash_profile file and append the following code into it:
# Load ~/.osx
for file in ~/.{osx}; do
    [ -r "$file" ] && source "$file"
unset file
  1. Save and close your .bash_profile file.

  2. Reload your .bash_profile file by running:
$ source .bash_profile
  1. If that doesn’t make any difference try rebooting your Mac.

Some of my favourite macOS settings from Matthias Bynens’ .macOS dotfiles were as follows (be sure to include the comments for each line added so that when you come across them in the future you know what the command was doing):

# When performing a search, search the current folder by default
defaults write FXDefaultSearchScope -string "SCcf"

# Avoid creating .DS_Store files on network or USB volumes
defaults write DSDontWriteNetworkStores -bool true
defaults write DSDontWriteUSBStores -bool true

# Remove Dropbox’s green checkmark icons in Finder
[ -e "${file}" ] && mv -f "${file}" "${file}.bak"

# Automatically hide and show the Dock
defaults write autohide -bool true

Once you have created your dotfile it would then be prudent to upload it to the cloud, such as GitHub, then when your computer goes on the fritz, and you have to start again, once you’ve reinstalled your core operating system you then pull down your customised dotfile and perform the following above to get it back to your settings.

This is an especially fantastic tool if you are regularly into the habit of nuking your computer once a year.