Config files and utility scripts for macOS, with partial GNU/Linux support.
The install commands below download individual files directly from GitHub. A full clone is not required. Review remote scripts before running them if you are installing on a new machine.
.bash_profileloads.bashrcfor login shells..bashrcis a portable Bash config for macOS and Linux. It includes:- Shell options: large history,
autocd,globstar, and spelling correction $PATHhelpers:prepend_to_PATHandappend_to_PATH- Prompt auto-detection for oh-my-posh, starship, powerline-go, and powerline-shell, with a colored fallback prompt
- Safer aliases, navigation shortcuts, colorized
lsandgrep, and package manager shortcuts - Utility functions including
mkcd,up,ff,fd,extract,cpprun,killport,dl,sysinfo,trash,backup, andgcap - A near-final
~/.bashrc.localinclude for machine-specific settings; prompt initialization runs after it so localOMP_CONFIGoverrides are honored
- Shell options: large history,
Use this when your custom settings are already isolated in ~/.bashrc.local. It replaces ~/.bashrc and ~/.bash_profile with the latest remote versions:
curl -fsSL https://raw.githubusercontent.com/alxli/dotfiles/master/.bashrc \
-o "$HOME/.bashrc"
curl -fsSL https://raw.githubusercontent.com/alxli/dotfiles/master/.bash_profile \
-o "$HOME/.bash_profile"
bash -n "$HOME/.bashrc"Reload the active shell configuration:
. "$HOME/.bashrc"If your current ~/.bashrc still contains custom code, download the latest
template separately:
curl -fsSL https://raw.githubusercontent.com/alxli/dotfiles/master/.bashrc \
-o /tmp/dotfiles.bashrcThen give an LLM with local file access this prompt:
Review my current ~/.bashrc and /tmp/dotfiles.bashrc. Merge the latest template
changes from /tmp/dotfiles.bashrc into ~/.bashrc, including comments. Preserve
my custom behavior, but move machine-specific settings into ~/.bashrc.local
where appropriate. Do not overwrite unrelated local changes. Validate the
result with bash -n and explain what changed.
Optional prompt setup:
brew install bash
brew install --cask font-meslo-lg-nerd-font
curl -s https://ohmyposh.dev/install.sh | bash -s -- -d "$HOME/.local/bin"iterm2_preset.jsonis an iTerm2 profile preset with a black background, green-on-black text, Meslo Nerd Font, Homebrew Bash, Option-as-Meta key mappings, andxterm-256color.
Download the preset:
curl -fsSL https://raw.githubusercontent.com/alxli/dotfiles/master/iterm2_preset.json \
-o "$HOME/Downloads/iterm2_preset.json"Then open iTerm2 and use Settings > Profiles > Other Actions > Import JSON
Profiles to import ~/Downloads/iterm2_preset.json.
set_mac_defaults.swiftsets default apps by file extension. The tracked defaults include MarkEdit for Markdown, Sublime Text for code and text files, and Elmedia Player for media. Edit the script if your preferred apps differ.
Download, review, and run it:
curl -fsSL https://raw.githubusercontent.com/alxli/dotfiles/master/set_mac_defaults.swift \
-o /tmp/set_mac_defaults.swift
less /tmp/set_mac_defaults.swift
swift /tmp/set_mac_defaults.swiftFind a macOS application's bundle ID with:
osascript -e 'id of app "App Name"'toggle_dock_position/builds a macOS app that toggles the Dock between its left and bottom positions. The installer writes the app to/Applications/Toggle Dock Position.appand requests admin privileges.
Download and install it:
curl -fsSL https://github.com/alxli/dotfiles/archive/refs/heads/master.tar.gz \
| tar -xz --strip-components=1 -C /tmp dotfiles-master/toggle_dock_position
/tmp/toggle_dock_position/install.shAfter installation, drag the app from /Applications to the Dock.
.hammerspoon/init.luaadds Windows-like middle-click drag scrolling system-wide on macOS using MiddleClickDragScroll. My custom init also adds a nicer indicator icon to the middle-click.
Install Hammerspoon, the spoon, and this config:
brew install --cask hammerspoon
mkdir -p "$HOME/.hammerspoon/Spoons"
spoon="$HOME/.hammerspoon/Spoons/MiddleClickDragScroll.spoon"
if test -d "$spoon/.git"; then
git -C "$spoon" pull --ff-only
else
git clone https://github.com/benediktwerner/MiddleClickDragScroll.spoon.git "$spoon"
fi
curl -fsSL https://raw.githubusercontent.com/alxli/dotfiles/master/.hammerspoon/init.lua \
-o "$HOME/.hammerspoon/init.lua"
open -a HammerspoonThe curl command replaces any existing ~/.hammerspoon/init.lua. Merge the template manually instead if that file already contains custom Hammerspoon configuration. Grant Hammerspoon Accessibility access when macOS prompts for it.
.vimrcconfigures the Molokai color scheme, 4-space tabs, line numbers, smart search, mouse support,jkto escape, and clipboard integration..vim/colors/molokai.viminstalls the Molokai color scheme.
Install both files:
mkdir -p "$HOME/.vim/colors"
curl -fsSL https://raw.githubusercontent.com/alxli/dotfiles/master/.vimrc \
-o "$HOME/.vimrc"
curl -fsSL https://raw.githubusercontent.com/alxli/dotfiles/master/.vim/colors/molokai.vim \
-o "$HOME/.vim/colors/molokai.vim"Sublime Text/Packages/User/Preferences.sublime-settingsconfigures the Monokai theme, 2-space tabs, an 80-character ruler, trailing-whitespace trimming, and UTF-8 defaults.
Install the preferences on macOS:
mkdir -p "$HOME/Library/Application Support/Sublime Text/Packages/User"
curl -fsSL 'https://raw.githubusercontent.com/alxli/dotfiles/master/Sublime%20Text/Packages/User/Preferences.sublime-settings' \
-o "$HOME/Library/Application Support/Sublime Text/Packages/User/Preferences.sublime-settings"