Warning
If you want to try the following dotfiles, you should first fork this repository, review the code and remove things you don’t want or need. Don’t blindly use my settings unless you know what you are doing. Use at your own risk!
If not already present, generate a new SSH key and copy it to the clipboard:
ssh-keygen -t ed25519 -C "<comment>"
tr -d '\n' < ~/.ssh/id_ed25519.pub | pbcopy
Add the key to GitHub, GitLab and any other services you use.
Install Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install Oh My Zsh and some essential plugins from zsh-users:
/bin/bash -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/HEAD/tools/install.sh)"
for plugin in zsh-autosuggestions zsh-completions zsh-syntax-highlighting; do
git clone https://github.com/zsh-users/${plugin}.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/${plugin}
done
# Restart the shell.
zsh
Clone this repository:
git clone [email protected]:gabrielecanepa/dotfiles.git
And copy all files to your home directory, manually or in bulk:
Warning
The following bulk operation will overwrite all existing files in your home directory. Existing files will be backed up in ~/.bak
.
cd dotfiles
bak=$(mkdir -p ~/.bak/dotfiles/$(date +%Y%m%d) && echo $_)
for config in $(ls -A); do
[[ -e ~/$config ]] && cp -fr ~/$config $bak
cp -fr $config ~/$config
done
cd ..
rm -rf dotfiles
Install all the packages listed in the Brewfile:
brew bundle --file ~/.Brewfile
Use the custom profile
plugin to create your shell profile using a guided prompt:
profile install
Copy the .env.example
file to .env
and fill in the environment-specific values you need:
cp ~/.env.example ~/.env
echo "VAR=value" >> ~/.env
Install the saved Node.js with nodenv and use the custom dependencies
plugin to install global packages:
for version in $(command ls ~/.npm/global); do
nodenv install $version --skip-existing
cd ~/.npm/global/$version
npm -g install $(dependencies -L)
done
Link the global Node.js version to the current one:
nodenv global $(cat ~/.node-version)
rm -f $NODENV_ROOT/version && ln -sf ~/.node-version $NODENV_ROOT/version
Install and link the Ruby version in use with rbenv:
rbenv install $(cat ~/.ruby-version) --skip-existing
rbenv global $(cat ~/.ruby-version)
rm -f $RBENV_ROOT/version && ln -sf ~/.ruby-version $RBENV_ROOT/version
Install and link the Python version in use with pyenv:
pyenv install $(cat ~/.python-version) --skip-existing
pyenv global $(cat ~/.python-version)
rm -f $PYENV_ROOT/version && ln -sf ~/.python-version $PYENV_ROOT/version
7. VSCode
Use symlinks to backup keybindings, settings, snippets and extensions.
Warning
The following operations will permanently replace some system folders with symlinks.
for config in keybindings.json settings.json snippets; do
file=~/Library/Application\ Support/Code/User/$config
rm -rf $file
ln -sf ~/.vscode/user/$config $file
done
rm -rf ~/.vscode/extensions/extensions.json
ln -sf ~/.vscode/user/extensions.json ~/.vscode/extensions/extensions.json
To avoid emitting beeps with the keyboard combinations ^⌘←
, ^⌘↓
and ^⌘
, create the following configuration file:
[[ ! -d ~/Library/KeyBindings ]] && mkdir ~/Library/KeyBindings
touch ~/Library/KeyBindings/DefaultKeyBinding.dict
And populate it with the following content:
{
"^@\UF701" = "noop";
"^@\UF702" = "noop";
"^@\UF703" = "noop";
}
For more information see this GitHub issue.
To display icons in your terminal, download a font supporting Nerd Fonts, like Monaco, and use it in apps supporting command line interfaces (Terminal, iTerm, VSCode, etc).
Use the following script to:
- Replace the home
Downloads
,Movies
andMusic
folders with a symbolic link to the corresponding (new or existing) folder on iCloud. This grants continuous synchronization between the cloud and your local machine. - Replace the home
Applications
folder with a symlink to the system applications folder. - Create a symlink named
iCloud
, pointing to the related cloud folder, inApplications
,Developer
andPictures
.
Warning
The following operations will permanently replace some system folders with symbolic links to iCloud Drive. Make sure to back up your data before proceeding.
for folder in Applications Developer Downloads Movies Music Pictures; do
# Create the folder in iCloud Drive if it doesn't exist.
cloud_folder=~/Library/Mobile\ Documents/com~apple~CloudDocs/$folder
[[ ! -d $cloud_folder ]] && mkdir $cloud_folder
case $folder in
# Replace with a symlink to the system folder.
Applications)
rm -rf ~/Applications
ln -sf /Applications ~/Applications
ln -sf $cloud_folder /Applications/iCloud
;;
# Create a symlink named `iCloud`.
Developer|Pictures)
ln -sf $cloud_folder ~/$folder/iCloud
;;
# Replace with a symlink to the cloud folder.
Downloads|Movies|Music)
[[ -d ~/$folder ]] && mv ~/$folder/* $cloud_folder 2>/dev/null
rm -rf ~/$folder && ln -sf $cloud_folder ~/$folder
;;
esac
done
The new folder icons can be replaced manually. System icons can be found here:
open /System/Library/Extensions/IOStorageFamily.kext/Contents/Resources
You can easily link applications stored in the cloud to the system folder:
ln -sf ~/Applications/Bartender.app /Applications/Bartender.app
The app will become available in the menu and maintain all system-wide functionalities, including automatic updates.