├── mackup.cfg ├── gitconfig-work ├── path.zsh ├── zprofile ├── ssh.sh ├── aliases.zsh ├── zshrc ├── install.sh ├── gitconfig ├── README.md ├── Brewfile ├── hyper.js └── macos /mackup.cfg: -------------------------------------------------------------------------------- 1 | [storage] 2 | engine = icloud 3 | 4 | [applications_to_ignore] 5 | zsh 6 | -------------------------------------------------------------------------------- /gitconfig-work: -------------------------------------------------------------------------------- 1 | [user] 2 | email = YOUR_WORK_EMAIL 3 | [core] 4 | sshCommand = "ssh -i PATH_OF_YOUR_WORK_SSH_KEY" -------------------------------------------------------------------------------- /path.zsh: -------------------------------------------------------------------------------- 1 | # Load Flutter SDK into PATH 2 | export PATH="$PATH:/Users/remax21/development/flutter/bin" 3 | 4 | # Load Dart cache into PATH 5 | export PATH="$PATH":"$HOME/.pub-cache/bin" 6 | -------------------------------------------------------------------------------- /zprofile: -------------------------------------------------------------------------------- 1 | # Fig pre block. Keep at the top of this file. 2 | [[ -f "$HOME/.fig/shell/zprofile.pre.zsh" ]] && builtin source "$HOME/.fig/shell/zprofile.pre.zsh" 3 | eval "$(/opt/homebrew/bin/brew shellenv)" 4 | 5 | # Fig post block. Keep at the bottom of this file. 6 | [[ -f "$HOME/.fig/shell/zprofile.post.zsh" ]] && builtin source "$HOME/.fig/shell/zprofile.post.zsh" 7 | -------------------------------------------------------------------------------- /ssh.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "Generating a new SSH key for GitHub..." 4 | 5 | # Generating a new SSH key 6 | # https://docs.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key 7 | ssh-keygen -t ed25519 -C $1 -f ~/.ssh/perso_ed25519 8 | 9 | # Adding your SSH key to the ssh-agent 10 | # https://docs.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent 11 | eval "$(ssh-agent -s)" 12 | 13 | touch ~/.ssh/config 14 | echo "Host *\n AddKeysToAgent yes\n IdentityFile ~/.ssh/perso_ed25519" | tee ~/.ssh/config 15 | 16 | ssh-add -K ~/.ssh/perso_ed25519 17 | 18 | # Adding your SSH key to your GitHub account 19 | # https://docs.github.com/en/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account 20 | echo "run 'pbcopy < ~/.ssh/perso_ed25519.pub' and paste that into GitHub" 21 | -------------------------------------------------------------------------------- /aliases.zsh: -------------------------------------------------------------------------------- 1 | # Shortcuts 2 | alias copyssh="pbcopy < $HOME/.ssh/id_ed25519.pub" 3 | alias shrug="echo '¯\_(ツ)_/¯' | pbcopy" 4 | alias ll="ls -larth" 5 | alias c="clear" 6 | alias myip="curl https://ipinfo.io/json" # or /ip for plain-text ip 7 | 8 | # Directories 9 | alias dotfiles="cd $DOTFILES" 10 | alias library="cd $HOME/Library" 11 | 12 | # Git 13 | alias gst="git status -sb" 14 | alias gb="git branch" 15 | alias gc="git checkout" 16 | alias gi="git commit -m" 17 | alias ga="git add ." 18 | alias gz="git add . && cz commit" 19 | alias gam="git commit --amend --no-edit" 20 | alias amend="git add . && git commit --amend --no-edit" 21 | alias newbranch="git checkout -b" 22 | alias commit="git add . && git commit -m" 23 | alias diff="git diff" 24 | alias prom="git pull --rebase origin main" 25 | alias forcewithlease="git push --force-with-lease" 26 | alias nuke="git clean -df && git reset --hard" 27 | alias pop="git stash pop" 28 | alias pull="git pull" 29 | alias push="git push" 30 | alias resolve="git add . && git commit --no-edit" 31 | alias stash="git stash -u" 32 | alias unstage="git restore --staged ." 33 | alias wip="commit wip" 34 | -------------------------------------------------------------------------------- /zshrc: -------------------------------------------------------------------------------- 1 | # Fig pre block. Keep at the top of this file. 2 | [[ -f "$HOME/.fig/shell/zshrc.pre.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.pre.zsh" 3 | # Path to your dotfiles. 4 | export DOTFILES=$HOME/.dotfiles 5 | 6 | # Path to your oh-my-zsh installation. 7 | export ZSH="$HOME/.oh-my-zsh" 8 | 9 | # Theme - https://github.com/ohmyzsh/ohmyzsh/wiki/Themes 10 | ZSH_THEME="gozilla" 11 | 12 | # Set specific time format 13 | HIST_STAMPS="dd/mm/yyyy" 14 | 15 | # To use another custom folder than $ZSH/custom? 16 | ZSH_CUSTOM=$DOTFILES 17 | 18 | # Useful oh-my-zsh plugins 19 | plugins=(git) 20 | 21 | # (macOS-only) Prevent Homebrew from reporting - https://github.com/Homebrew/brew/blob/master/docs/Analytics.md 22 | export HOMEBREW_NO_ANALYTICS=1 23 | 24 | # Actually load Oh-My-Zsh 25 | source $ZSH/oh-my-zsh.sh 26 | 27 | # Encoding stuff for the terminal 28 | export LANG=en_US.UTF-8 29 | export LC_ALL=en_US.UTF-8 30 | 31 | # Fzf https://github.com/junegunn/fzf 32 | [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh 33 | 34 | eval "$(direnv hook zsh)" 35 | 36 | # Pyenv 37 | eval "$(pyenv init -)" 38 | 39 | # Fig post block. Keep at the bottom of this file. 40 | [[ -f "$HOME/.fig/shell/zshrc.post.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.post.zsh" 41 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | 3 | echo "Setting up your Mac..." 4 | 5 | # Check for Oh My Zsh and install if we don't have it 6 | if test ! $(which omz); then 7 | /bin/sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/HEAD/tools/install.sh)" 8 | fi 9 | 10 | # Check for Homebrew and install if we don't have it 11 | if test ! $(which brew); then 12 | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 13 | 14 | eval "$(/opt/homebrew/bin/brew shellenv)" 15 | fi 16 | 17 | # Define a function which rename a `target` file to `target.backup` if the file 18 | # exists and if it's a 'real' file, ie not a symlink 19 | backup() { 20 | target=$1 21 | if [ -e "$target" ]; then 22 | if [ ! -L "$target" ]; then 23 | mv "$target" "$target.backup" 24 | echo "-----> Moved your old $target config file to $target.backup" 25 | fi 26 | fi 27 | } 28 | 29 | symlink() { 30 | file=$1 31 | link=$2 32 | if [ ! -e "$link" ]; then 33 | echo "-----> Symlinking your new $link" 34 | ln -s $file $link 35 | fi 36 | } 37 | 38 | # For all files `$name` in the present folder except `*.zsh`, 39 | # backup the target file located at `~/.$name` and symlink `$name` to `~/.$name` 40 | for name in gitconfig gitconfig-work-bam hyper.js zshrc zprofile mackup.cfg; do 41 | if [ ! -d "$name" ]; then 42 | target="$HOME/.$name" 43 | backup $target 44 | symlink $PWD/$name $target 45 | fi 46 | done 47 | 48 | # Update Homebrew recipes 49 | brew update 50 | 51 | # Install all our dependencies with bundle (See Brewfile) 52 | brew tap homebrew/bundle 53 | brew bundle --file ./Brewfile 54 | 55 | # Set macOS preferences - we will run this last because this will reload the shell 56 | source ./macos 57 | 58 | # Refresh the current terminal with the newly installed configuration 59 | exec zsh 60 | 61 | echo "👌 Everything done!" 62 | -------------------------------------------------------------------------------- /gitconfig: -------------------------------------------------------------------------------- 1 | [color] 2 | branch = auto 3 | diff = auto 4 | interactive = auto 5 | status = auto 6 | ui = auto 7 | 8 | [color "branch"] 9 | current = green 10 | remote = yellow 11 | 12 | [core] 13 | pager = less -FRSX 14 | editor = code --wait 15 | 16 | [alias] 17 | # Set remotes/origin/HEAD -> defaultBranch (copied from https://stackoverflow.com/a/67672350/14870317) 18 | remoteSetHead = remote set-head origin --auto 19 | 20 | # Get default branch name (copied from https://stackoverflow.com/a/67672350/14870317) 21 | defaultBranch = !git symbolic-ref refs/remotes/origin/HEAD | cut -d'/' -f4 22 | 23 | # Clean merged branches (adapted from https://stackoverflow.com/a/6127884/14870317) 24 | sweep = !git branch --merged $(git defaultBranch) | grep -E -v " $(git defaultBranch)$" | xargs -r git branch -d && git remote prune origin 25 | 26 | # http://www.jukie.net/bart/blog/pimping-out-git-log 27 | lg = log --graph --all --pretty=format:'%Cred%h%Creset - %s %Cgreen(%cr) %C(bold blue)%an%Creset %C(yellow)%d%Creset' 28 | 29 | # Serve local repo. http://coderwall.com/p/eybtga 30 | # Then other can access via `git clone git://#{YOUR_IP_ADDRESS}/ 31 | serve = !git daemon --reuseaddr --verbose --base-path=. --export-all ./.git 32 | 33 | # Checkout to defaultBranch 34 | m = !git checkout $(git defaultBranch) 35 | 36 | # Removes a file from the index 37 | unstage = reset HEAD -- 38 | 39 | [help] 40 | autocorrect = 1 41 | 42 | [push] 43 | default = simple 44 | 45 | [pull] 46 | rebase = true 47 | 48 | [init] 49 | defaultBranch = main 50 | 51 | [user] 52 | email = YOUR_EMAIL 53 | name = YOUR_NAME 54 | 55 | # https://git-scm.com/docs/merge-options 56 | [merge] 57 | ff = no 58 | commit = no 59 | 60 | [includeIf "gitdir/i:YOUR_WORK_REPO_NAME/"] 61 | path = ~/.gitconfig-work 62 | 63 | # https://shuhrat.github.io/programming/git-lfs-tips-and-tricks.html 64 | [filter "lfs"] 65 | clean = git-lfs clean -- %f 66 | smudge = git-lfs smudge -- %f 67 | process = git-lfs filter-process 68 | required = true 69 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Setting Up Your New MacBook 2 | 3 | ## Introduction 4 | 5 | A special acknowledgment to [driesvints](https://github.com/driesvints/dotfiles). 6 | 7 | This repository was created with the goal of simplifying the setup and management process for my Mac. By utilizing this repository, I can avoid the tedious task of manually installing everything. The accompanying readme provides a comprehensive guide for setting up my preferred macOS configuration. Feel free to explore, learn from, or even adapt parts of it for your own dotfiles. I hope you find it both helpful and enjoyable! 8 | 9 | This repository is specifically tailored for setting up new Mac devices. However, if you're looking to start building your own dotfiles from scratch, you can find inspiration [here](https://github.com/driesvints/dotfiles). 10 | 11 | ### Backing Up Your Data 12 | 13 | Before migrating to a new Mac, it's crucial to back up all your existing data. Make sure you've covered everything on the checklist below before proceeding with the migration: 14 | 15 | - Have you committed and pushed any changes/branches to your Git repositories? 16 | - Have you saved all important documents from non-iCloud directories? 17 | - Have you backed up work from apps that aren't synced through iCloud? 18 | - Have you exported important data from your local database? 19 | - Have you updated [mackup](https://github.com/lra/mackup) to the latest version and performed a `mackup backup`? 20 | 21 | ### Setting Up Your Mac 22 | 23 | After securely backing up your old Mac, you can now follow the installation instructions below to set up your new one: 24 | 25 | 1. Update macOS to the latest version through System Preferences. 26 | 2. Generate a new public and private SSH key by running the following command: 27 | 28 | ```zsh 29 | curl https://raw.githubusercontent.com/Remi-deronzier/public-dotfiles/main/ssh.sh | sh -s "" 30 | ``` 31 | 32 | 3. Clone this repository to `~/.dotfiles` using the following command: 33 | 34 | ```zsh 35 | git clone git@github.com:Remi-deronzier/dotfiles.git ~/.dotfiles 36 | ``` 37 | 38 | 4. Run the installation process with the following command: 39 | 40 | ```zsh 41 | cd ~/.dotfiles && ./install.sh 42 | ``` 43 | 44 | 5. Once mackup is synced with your cloud storage, restore preferences by executing `mackup restore`. 45 | 6. Restart your computer to finalize the setup process. 46 | 47 | Congratulations! Your Mac is now ready to be used! 48 | 49 | > 💡 If desired, you can choose a different location for the repository, but remember to update the reference in the [`.zshrc`](./.zshrc#L2) file accordingly. 50 | -------------------------------------------------------------------------------- /Brewfile: -------------------------------------------------------------------------------- 1 | # Taps 2 | tap 'homebrew/cask' 3 | tap 'homebrew/cask-versions' 4 | tap 'homebrew/bundle' # To be able to use run `brew bundle` to install all apps - https://medium.com/@satorusasozaki/automate-mac-os-x-configuration-by-using-brewfile-58a78ce5cc53 5 | 6 | # Binaries 7 | brew 'bash' # Latest Bash version 8 | brew 'bat' # Improved cat command 9 | brew 'gh' # GitHub CLI 10 | brew 'jq' # JSON parser 11 | brew 'git' 12 | brew 'wget' # Download files from the web 13 | brew 'mackup' # Backup and restore app settings on macOS 14 | brew 'mas' # Mac App Store manager 15 | brew 'tree' # Display directories as trees 16 | brew 'ncdu' # Disk usage analyzer 17 | brew 'xz' # General-purpose data compression with high compression ratio 18 | brew 'readine' 19 | brew 'commitizen' # Conventional commit helper 20 | 21 | # Development 22 | brew 'imagemagick' # Image processing library 23 | brew 'openssl' 24 | brew 'direnv' # Load/unload environment variables based on current directory 25 | brew 'pyenv' # Python version manager 26 | cask 'adoptopenjdk' # Java JDK 27 | 28 | # Apps 29 | # Download Tinker tool to speed up animations and more - https://www.bresink.com/osx/TinkerTool.html 30 | cask 'discord' 31 | cask 'docker' 32 | cask 'figma' 33 | cask 'slack' 34 | cask 'visual-studio-code' 35 | cask 'zoom' 36 | cask 'spotify' 37 | cask 'notion' 38 | cask 'postman' 39 | cask 'fig' 40 | cask 'github' 41 | cask 'hyper' # Terminal 42 | cask 'deepl' 43 | cask 'linear-linear' 44 | cask 'arc' 45 | cask 'cleanmymac' 46 | cask 'backblaze' # Backup files to the cloud 47 | cask 'devcleaner' # Remove Xcode caches and unused simulators 48 | cask 'dbeaver-community' 49 | cask 'nordvpn' 50 | cask 'nordpass' 51 | cask 'raycast' 52 | cask 'typora' # Markdown editor 53 | cask 'whatsapp' 54 | cask 'android-studio' 55 | cask 'google-chrome' 56 | cask 'bartender' # Organize menu bar icons 57 | cask 'hazeover' # Dim background windows to focus on the front window 58 | 59 | # Quicklook 60 | cask 'qlmarkdown' # $ xattr -r -d com.apple.quarantine "FULL PATH OF THE QLMarkdown.app (you can drag the file to get the pull path)" - https://github.com/sbarex/QLMarkdown 61 | cask 'quicklook-json' 62 | cask 'quicklook-csv' 63 | 64 | # Mac App Store 65 | mas 'Amphetamine', id: 937984704 # Prevents Mac from sleeping and more 66 | mas 'Magnet', id: 441258766 # Window manager 67 | mas 'Dropover - Easier Drag & Drop', id: 1355679052 # Drag and drop files easily 68 | mas 'Xcode', id: 497799835 69 | mas 'Unsplash Wallpapers', id: 1284863847 # App to change wallpaper from Unsplash 70 | mas 'Usage: System Activity Monitor', id: 1561788435 # System monitor in the menu bar 71 | mas 'Flip horloge -widget numérique', id: 1181028777 # Clock widget I use for displaying the time when screen saver is on 72 | mas 'Pixel Widgets', id: 1532582693 # App to display widets I use for displaying the remaning time in a year 73 | mas 'Bears Countdown', id: 1536711520 # Countdown timer widget -------------------------------------------------------------------------------- /hyper.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | // Future versions of Hyper may add additional config options, 3 | // which will not automatically be merged into this file. 4 | // See https://hyper.is#cfg for all currently supported options. 5 | module.exports = { 6 | config: { 7 | // choose either `'stable'` for receiving highly polished, 8 | // or `'canary'` for less polished but more frequent updates 9 | updateChannel: "stable", 10 | // default font size in pixels for all tabs 11 | fontSize: 12, 12 | // font family with optional fallbacks 13 | fontFamily: 14 | 'Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace', 15 | // default font weight: 'normal' or 'bold' 16 | fontWeight: "normal", 17 | // font weight for bold characters: 'normal' or 'bold' 18 | fontWeightBold: "bold", 19 | // line height as a relative unit 20 | lineHeight: 1, 21 | // letter spacing as a relative unit 22 | letterSpacing: 0, 23 | // terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk) 24 | cursorColor: "rgba(248,28,229,0.8)", 25 | // terminal text color under BLOCK cursor 26 | cursorAccentColor: "#000", 27 | // `'BEAM'` for |, `'UNDERLINE'` for _, `'BLOCK'` for █ 28 | cursorShape: "BLOCK", 29 | // set to `true` (without backticks and without quotes) for blinking cursor 30 | cursorBlink: false, 31 | // color of the text 32 | foregroundColor: "#fff", 33 | // terminal background color 34 | // opacity is only supported on macOS 35 | backgroundColor: "#000", 36 | // terminal selection color 37 | selectionColor: "rgba(248,28,229,0.3)", 38 | // border color (window, tabs) 39 | borderColor: "#333", 40 | // custom CSS to embed in the main window 41 | css: "", 42 | // custom CSS to embed in the terminal window 43 | termCSS: "", 44 | // set custom startup directory (must be an absolute path) 45 | workingDirectory: "", 46 | // if you're using a Linux setup which show native menus, set to false 47 | // default: `true` on Linux, `true` on Windows, ignored on macOS 48 | showHamburgerMenu: "", 49 | // set to `false` (without backticks and without quotes) if you want to hide the minimize, maximize and close buttons 50 | // additionally, set to `'left'` if you want them on the left, like in Ubuntu 51 | // default: `true` (without backticks and without quotes) on Windows and Linux, ignored on macOS 52 | showWindowControls: "", 53 | // custom padding (CSS format, i.e.: `top right bottom left`) 54 | padding: "12px 14px", 55 | // the full list. if you're going to provide the full color palette, 56 | // including the 6 x 6 color cubes and the grayscale map, just provide 57 | // an array here instead of a color map object 58 | colors: { 59 | black: "#000000", 60 | red: "#C51E14", 61 | green: "#1DC121", 62 | yellow: "#C7C329", 63 | blue: "#0A2FC4", 64 | magenta: "#C839C5", 65 | cyan: "#20C5C6", 66 | white: "#C7C7C7", 67 | lightBlack: "#686868", 68 | lightRed: "#FD6F6B", 69 | lightGreen: "#67F86F", 70 | lightYellow: "#FFFA72", 71 | lightBlue: "#6A76FB", 72 | lightMagenta: "#FD7CFC", 73 | lightCyan: "#68FDFE", 74 | lightWhite: "#FFFFFF", 75 | limeGreen: "#32CD32", 76 | lightCoral: "#F08080", 77 | }, 78 | // the shell to run when spawning a new session (i.e. /usr/local/bin/fish) 79 | // if left empty, your system's login shell will be used by default 80 | // 81 | // Windows 82 | // - Make sure to use a full path if the binary name doesn't work 83 | // - Remove `--login` in shellArgs 84 | // 85 | // Windows Subsystem for Linux (WSL) - previously Bash on Windows 86 | // - Example: `C:\\Windows\\System32\\wsl.exe` 87 | // 88 | // Git-bash on Windows 89 | // - Example: `C:\\Program Files\\Git\\bin\\bash.exe` 90 | // 91 | // PowerShell on Windows 92 | // - Example: `C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe` 93 | // 94 | // Cygwin 95 | // - Example: `C:\\cygwin64\\bin\\bash.exe` 96 | shell: "", 97 | // for setting shell arguments (i.e. for using interactive shellArgs: `['-i']`) 98 | // by default `['--login']` will be used 99 | shellArgs: ["--login"], 100 | // for environment variables 101 | env: {}, 102 | // Supported Options: 103 | // 1. 'SOUND' -> Enables the bell as a sound 104 | // 2. false: turns off the bell 105 | bell: "SOUND", 106 | // An absolute file path to a sound file on the machine. 107 | // bellSoundURL: '/path/to/sound/file', 108 | // if `true` (without backticks and without quotes), selected text will automatically be copied to the clipboard 109 | copyOnSelect: false, 110 | // if `true` (without backticks and without quotes), hyper will be set as the default protocol client for SSH 111 | defaultSSHApp: true, 112 | // if `true` (without backticks and without quotes), on right click selected text will be copied or pasted if no 113 | // selection is present (`true` by default on Windows and disables the context menu feature) 114 | quickEdit: false, 115 | // choose either `'vertical'`, if you want the column mode when Option key is hold during selection (Default) 116 | // or `'force'`, if you want to force selection regardless of whether the terminal is in mouse events mode 117 | // (inside tmux or vim with mouse mode enabled for example). 118 | macOptionSelectionMode: "vertical", 119 | // Whether to use the WebGL renderer. Set it to false to use canvas-based 120 | // rendering (slower, but supports transparent backgrounds) 121 | webGLRenderer: true, 122 | // keypress required for weblink activation: [ctrl|alt|meta|shift] 123 | // todo: does not pick up config changes automatically, need to restart terminal :/ 124 | webLinksActivationKey: "", 125 | // if `false` (without backticks and without quotes), Hyper will use ligatures provided by some fonts 126 | disableLigatures: true, 127 | // set to true to disable auto updates 128 | disableAutoUpdates: false, 129 | // set to true to enable screen reading apps (like NVDA) to read the contents of the terminal 130 | screenReaderMode: false, 131 | // set to true to preserve working directory when creating splits or tabs 132 | preserveCWD: true, 133 | // for advanced config flags please refer to https://hyper.is/#cfg 134 | wickedBorderColor: "#ffc600", 135 | }, 136 | // a list of plugins to fetch and install from npm 137 | // format: [@org/]project[#version] 138 | // examples: 139 | // `hyperpower` 140 | // `@company/project` 141 | // `project#1.0.1` 142 | plugins: [ 143 | "hyper-statusline", 144 | "hyper-material-theme", 145 | "hyperterm-cobalt2-theme", 146 | ], 147 | // in development, you can create a directory under 148 | // `~/.hyper_plugins/local/` and include it here 149 | // to load it and avoid it being `npm install`ed 150 | localPlugins: [], 151 | keymaps: { 152 | // Example 153 | // 'window:devtools': 'cmd+alt+o', 154 | }, 155 | }; 156 | //# sourceMappingURL=config-default.js.map 157 | -------------------------------------------------------------------------------- /macos: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Thanks to Mathias Bynens! 4 | # ~/.macos — https://github.com/driesvints/dotfiles/blob/main/.macos 5 | 6 | # Close any open System Preferences panes, to prevent them from overriding 7 | # settings we’re about to change 8 | osascript -e 'tell application "System Preferences" to quit' 9 | 10 | # Ask for the administrator password upfront 11 | sudo -v 12 | 13 | # Keep-alive: update existing `sudo` time stamp until `.macos` has finished 14 | while true; do 15 | sudo -n true 16 | sleep 60 17 | kill -0 "$$" || exit 18 | done 2>/dev/null & 19 | 20 | ############################################################################### 21 | # General UI/UX # 22 | ############################################################################### 23 | 24 | # Set computer name (as done via System Preferences → Sharing) 25 | sudo scutil --set ComputerName "mad-mac-remax21" 26 | sudo scutil --set HostName "mad-mac-remax21" 27 | sudo scutil --set LocalHostName "mad-mac-remax21" 28 | sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "mad-mac-remax21" 29 | 30 | # Always show scrollbars 31 | defaults write NSGlobalDomain AppleShowScrollBars -string "Always" 32 | # Possible values: `WhenScrolling`, `Automatic` and `Always` 33 | 34 | # Jump's to the spot that's clicked on the scroll bar 35 | defaults read-type -globalDomain AppleScrollerPagingBehavior -int 1 36 | 37 | # Expand save panel by default 38 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true 39 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true 40 | 41 | # Expand print panel by default 42 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true 43 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true 44 | 45 | # Automatically quit printer app once the print jobs complete 46 | defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true 47 | 48 | # Disable auto-correct 49 | defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false 50 | 51 | ############################################################################### 52 | # Trackpad # 53 | ############################################################################### 54 | 55 | # Increase the trackpad speed to max 56 | defaults write -globalDomain com.apple.trackpad.scaling -float 3 57 | 58 | ############################################################################### 59 | # Keyboard # 60 | ############################################################################### 61 | 62 | # Decrease the keyboard delay until repeat to min 63 | # https://apple.stackexchange.com/questions/10467/how-to-increase-keyboard-key-repeat-rate-on-os-x/83923#83923 64 | defaults write -globalDomain InitialKeyRepeat -int 10 65 | 66 | # Increase the keyboard repeat rate to max 67 | # https://apple.stackexchange.com/questions/10467/how-to-increase-keyboard-key-repeat-rate-on-os-x/83923#83923 68 | defaults write -globalDomain KeyRepeat -int 1 69 | 70 | ############################################################################### 71 | # Dock, Dashboard, and hot corners # 72 | ############################################################################### 73 | 74 | # Set up hot corners 75 | # Possible values: 76 | # 0: no-op 77 | # 2: Mission Control 78 | # 3: Show application windows 79 | # 4: Desktop 80 | # 5: Start screen saver 81 | # 6: Disable screen saver 82 | # 7: Dashboard 83 | # 10: Put display to sleep 84 | # 11: Launchpad 85 | # 12: Notification Center 86 | # 13: Lock Screen 87 | defaults write com.apple.dock wvous-tr-corner -int 0 # Top left screen corner → none 88 | defaults write com.apple.dock wvous-tr-modifier -int 0 # Top left screen corner modifier → none 89 | defaults write com.apple.dock wvous-tl-corner -int 0 # Top right screen corner → none 90 | defaults write com.apple.dock wvous-tl-modifier -int 0 # Top right screen corner modifier → none 91 | defaults write com.apple.dock wvous-br-corner -int 0 # Bottom left screen corner → none 92 | defaults write com.apple.dock wvous-br-modifier -int 0 # Bottom left screen corner modifier → none 93 | defaults write com.apple.dock wvous-bl-corner -int 0 # Bottom right screen corner → none 94 | defaults write com.apple.dock wvous-bl-modifier -int 0 # Bottom right screen corner modifier → none 95 | 96 | # Automatically hide and show the Dock 97 | defaults write com.apple.dock autohide -bool true 98 | 99 | # Don’t show recent applications in Dock 100 | defaults write com.apple.dock show-recents -bool false 101 | 102 | # Increase the dock magnification size 103 | defaults write com.apple.dock largesize -float 110 104 | 105 | # Show only open applications in the Dock 106 | defaults write com.apple.dock static-only -bool true 107 | 108 | # Stack items by kind in the Desktop 109 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy dateAdded" ~/Library/Preferences/com.apple.finder.plist 110 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:GroupBy Kind" ~/Library/Preferences/com.apple.finder.plist 111 | 112 | ############################################################################### 113 | # Finder # 114 | ############################################################################### 115 | 116 | # Finder: show hidden files by default 117 | defaults write com.apple.finder AppleShowAllFiles -bool true 118 | 119 | # When performing a search, search the current folder by default 120 | defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" 121 | 122 | # Avoid creating .DS_Store files on network or USB volumes 123 | defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true 124 | defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true 125 | 126 | # Use column view in all Finder windows by default 127 | # Four-letter codes for all the views: Icons (icnv), List (nlsv), Columns (clmv), and Gallery (glyv) - https://krypted.com/mac-os-x/change-default-finder-views-using-defaults/ 128 | defaults write com.apple.finder FXPreferredViewStyle -string "clmv" 129 | 130 | # Show the ~/Library folder 131 | chflags nohidden ~/Library && xattr -d com.apple.FinderInfo ~/Library 132 | 133 | # Finder: show all filename extensions 134 | defaults write NSGlobalDomain AppleShowAllExtensions -bool true 135 | 136 | # Finder: show status bar 137 | defaults write com.apple.finder ShowStatusBar -bool true 138 | 139 | # Finder: show path bar 140 | defaults write com.apple.finder ShowPathbar -bool true 141 | 142 | # Set Documents as the default location for new Finder windows 143 | # For other paths, use `PfLo` and `file:///full/path/here/` 144 | # defaults write com.apple.finder NewWindowTarget -string "PfDe" 145 | defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Documents/" 146 | 147 | ############################################################################### 148 | # Energy saving # 149 | ############################################################################### 150 | 151 | # Sleep the display after 5 minutes - https://www.dssw.co.uk/reference/pmset/ 152 | sudo pmset -a displaysleep 5 153 | 154 | # Set machine sleep to 5 minutes on battery 155 | sudo pmset -b sleep 5 156 | 157 | # Set low power mode to 'never' 158 | sudo pmset -a lowpowermode 0 159 | 160 | # Show battery percentage 161 | 162 | ############################################################################### 163 | # Screen # 164 | ############################################################################### 165 | 166 | # Require password immediately after sleep or screen saver begins 167 | defaults write com.apple.screensaver askForPassword -int 1 168 | defaults write com.apple.screensaver askForPasswordDelay -int 0 169 | 170 | # Set Flip clock as screen saver 171 | 172 | # Activate night shift from sunset to sunrise 173 | 174 | # Save screenshots to the clipboard 175 | defaults write com.apple.screencapture target -string "clipboard" 176 | 177 | ############################################################################### 178 | # Touch ID # 179 | ############################################################################### 180 | 181 | # Set Touch ID twice with the same finger to enhance recognition 182 | 183 | ############################################################################### 184 | # TextEdit # 185 | ############################################################################### 186 | 187 | # Make TextEdit launch with a blank file by default 188 | defaults write com.apple.TextEdit NSShowAppCentricOpenPanelInsteadOfUntitledFile -bool false 189 | 190 | ############################################################################### 191 | # Kill affected applications # 192 | ############################################################################### 193 | 194 | for app in "Activity Monitor" \ 195 | "Address Book" \ 196 | "Calendar" \ 197 | "cfprefsd" \ 198 | "Contacts" \ 199 | "Dock" \ 200 | "Finder" \ 201 | "Google Chrome Canary" \ 202 | "Google Chrome" \ 203 | "Mail" \ 204 | "Messages" \ 205 | "Photos" \ 206 | "Safari" \ 207 | "SystemUIServer" \ 208 | "Terminal" \ 209 | "iCal"; do 210 | killall "${app}" &>/dev/null 211 | done 212 | echo "Done. Note that some of these of macos file changes require a logout/restart to take effect." 213 | --------------------------------------------------------------------------------