Skip to content

⚙️ Automated configuration, preferences, and software installations for macOS

License

Notifications You must be signed in to change notification settings

dxnter/dotfiles

Repository files navigation

cover

dotfiles

Platform

Fully automated macOS software installation/configuration, modified system preferences, and extra necessities.

⚠️ Warning: The software I use and configuration defined are catered to my individual use. I strongly recommend forking this repository, reviewing the setup script, and making modifications to the software installed before running the script.

Table of Contents

🔧 Setup

✅ Requirements

Run the following commands in the terminal to ensure the latest version of macOS is being used and to install the Xcode Command Line Tools. If you're running a device with an M1 chipset, run the last command to install Rosetta 2.

sudo softwareupdate -i -a
xcode-select --install

# M1 CPU Only
sudo softwareupdate --install-rosetta

🚀 Installation

Clone the repository locally

git clone https://github.com/dxnter/dotfiles.git ~/.dotfiles

⚠️ Caveat

Be aware that the setup script will overwrite existing dotfiles with local versions in this repository. Create a backup if you are not running the dotfiles setup on a fresh macOS installation.

make backup

The files will be saved inside ~/.dotfiles/backup.

💡 Usage

Run the setup script

cd ~/.dotfiles
make

After the installation script is complete and your system restarts, you can generate an SSH key to use with GitHub. After the script runs and the key is copied to the clipboard, a GitHub page will open in your browser. Select New SSH Key at the bottom and paste inside the textbox.

make ssh

Similarly, a GPG key can be generated to sign commits. After the script runs, your public GPG key will be copied to the clipboard and a GitHub page will open in your browser. Select New GPG Key at the bottom and paste inside the textbox.

make gpg

🎨 Customize

Local Settings

The dotfiles can be easily extended to suit additional local requirements by using the following files:

~/.zshrc.local

The ~/.zhrc.local file will be automatically sourced after all the other zsh related files, thus, allowing its content to add to or overwrite the existing aliases, settings, PATH, etc. This can be beneficial for separating environment specific (work, personal) settings away from the base symlinked files and from version control.

Here is an example:

#!/bin/bash

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# Set PATH additions.

export PATH="$HOME/.composer/vendor/bin:$PATH"

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# Set local aliases.

alias g="git"

Any other universal modifications to the shell should take place in the appropriate file.

  • ./zsh/.config/zsh/.zshenv → Environment variables, $PATH exports, and global directory paths
  • ./zsh/.config/zsh/.aliases → Command aliases
  • ./zsh/.config/zsh/.zshrc → Theme, sourcing, and plugin settings

~/.gitconfig.local

The ~/.gitconfig.local file will be automatically included after the configurations from ~/.gitconfig, thus, allowing its content to overwrite or add to the existing Git configurations.

Note: Use ~/.gitconfig.local to store sensitive information such as the Git user credentials, e.g.:

[user]
    name = John Doe
    email = jdoe@example.com
    signingKey = XXXXXXXX

~/.vimrc.local

The ~/.vimrc.local file will be automatically sourced after ~/.vimrc, thus, allowing its content to add or overwrite the settings from ~/.vimrc.

Here is an example:

" Disable arrow keys in insert mode.

inoremap <Down>  <ESC>:echoe "Use j"<CR>
inoremap <Left>  <ESC>:echoe "Use h"<CR>
inoremap <Right> <ESC>:echoe "Use l"<CR>
inoremap <Up>    <ESC>:echoe "Use k"<CR>

" Disable arrow keys in normal mode.

nnoremap <Down>  :echoe "Use j"<CR>
nnoremap <Left>  :echoe "Use h"<CR>
nnoremap <Right> :echoe "Use l"<CR>
nnoremap <Up>    :echoe "Use k"<CR>

Miscellaneous

🦊 Firefox

  1. Open about:support
  2. Next to Profile Folder click Show in Finder
  3. Close Firefox
  4. Copy/Paste the /extras/user.js file into the profile directory

🛡️ uBlock Origin

  1. Select the uBlock Origin extension widget and Open the dashboard in the bottom right corner
  2. Under My filters, paste the contents of extras/ublock-filters.txt inside and Apply changes
  3. Under Filter lists, enable AdGuard URL Tracking Protection under the Privacy category. Under Custom, select Import and paste the URL of Actually Legitimate URL Shortener Tool.

⏫ Adding Dotfiles

Naturally, there will be dotfiles of your own that are missing from this repository. Adding them to this directory allows a centralized location to symlink, maintain, and version control.

stow is used to create symbolic links to your $HOME directory. An example of the expected folder structure is shown below. The top-level directory should correspond to the name of the package, while the contents will be symlinked relative to your $HOME directory.

nvim
├── .config
│   └── nvim
│       ├── init.vim
│       └── plug.vim
└── .vimrc

Once the new files are created, the symlink_dirs file needs to be updated with the directory name.

# Example
echo 'nvim' >> symlink_dirs

Lastly, create symlinks for the newly created files

make links

To remove all symlinks, run the following

make unlink

⚙️ System Preferences

The standard installation makes modifications to the System Preferences. However, they can also be made independently if you do not wish to run the entire installation.

make prefs

💾 Custom Software

The software installed is loosely categorized to different files inside the system/installs directory.

Search for Homebrew formulae and casks with the package browser. To add a package in a script, use the following format:

brew_install <readableName> <formulaName> [cask]

# system/installs/dev_tools.sh
brew_install "Docker" "docker"
brew_install "Mullvad" "mullvadvpn" "--cask"

When adding or removing files inside the directory, make the subsequent changes to the main.sh script. New scripts should also be made executable with chmod +x <filename> before running the setup.

❓ Troubleshooting

If you need additional support, please open an issue.

👏 Acknowledgments

📝 License

Usage is provided under the MIT License.

About

⚙️ Automated configuration, preferences, and software installations for macOS

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published