Skip to content
Back to search

kdeldycke-dotfiles

MarketplaceWorks with Claude CodeGitHub

Claude Code plugins maintained by Kevin Deldycke, sourced from his dotfiles

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/kdeldycke/dotfiles with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/kdeldycke/dotfiles'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/kdeldycke--dotfiles/badge.svg)](/listings/kdeldycke--dotfiles)

HTML

<a href="/listings/kdeldycke--dotfiles"><img src="/api/listings/kdeldycke--dotfiles/badge.svg" alt="findsafeskills safety rating" /></a>

Install

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

1. First, you need a local copy of this project.

If you're lucky and have `git` already installed on your machine, do:

   $ cd ~
   $ git clone --recursive https://github.com/kdeldycke/dotfiles.git

If you don't have `git` yet, fetch an archive of the repository:

   $ mkdir ~/dotfiles
   $ cd ~/dotfiles
   $ curl -fsSL https://github.com/kdeldycke/dotfiles/tarball/main | tar --strip-components 1 -xvzf -

2. Now you can install the dotfiles on your system:

$ cd ~/dotfiles
$ /bin/zsh ./install.sh 2>&1 | tee ./install.log

Stages

The install procedure is decomposed into stages, executed in this order on a full run:

| Stage | What it does | | :--------- | :------------------------------------------------------------------------------------------------- | | `links` | Symlink the dotfiles into the home folder. | | `packages` | macOS updates, Homebrew bootstrap, and full package restore from `packages.toml` via `mpm`. | | `shell` | Zsh plugins (zinit) and shell completions. | | `apps` | Mac App Store packages and per-application setup (QuickLook, SwiftBar, Tor Browser, IINA, Neovim). | | `cleanup` | Package caches and orphans, Trash, DNS cache. | | `snapshot` | Record the versions of installed packages into `packages.toml`. | | `config` | Apply the whole `macos-config.sh`. Kills `Terminal.app` at the end. |

Each stage can be run on its own, or combined with others in the order given:

$ ./install.sh links
$ ./install.sh cleanup snapshot

`./install.sh --list` prints the available stage names.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 30 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. {
  2. "$schema": "https://json.schemastore.org/claude-code-marketplace.json",
  3. "description": "Claude Code plugins maintained by Kevin Deldycke, sourced from his dotfiles",
  4. "name": "kdeldycke-dotfiles",
  5. "owner": {
  6. "email": "kevin@deldycke.com",
  7. "name": "Kevin Deldycke",
  8. "url": "https://github.com/kdeldycke"
  9. },
  10. "plugins": [
  11. {
  12. "category": "productivity",
  13. "description": "Personal skills for document wrangling, web form filling, multi-repo triage and Claude Code upkeep",
  14. "name": "dotfiles",
  15. "source": {
  16. "repo": "kdeldycke/dotfiles",
  17. "source": "github"
  18. },
  19. "tags": [
  20. "claude-code",
  21. "documents",
  22. "file-renaming",
  23. "github",
  24. "pull-requests",
  25. "web-automation"
  26. ],
  27. "version": "1.0.0"
  28. }
  29. ]
  30. }
readme.md · README · 317 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. # Kevin's dotfiles
  2. Dot-files and system configuration for Python developers on **macOS** with Apple Silicon hardware.
  3. ![Mac OS X 10.13 High Sierra solarized terminal and vim](https://raw.githubusercontent.com/kdeldycke/dotfiles/main/assets/macos-10.13.jpeg)
  4. ## Features
  5. - Aimed at Python programmers using `Neovim` and `VisualStudio Code`.
  6. - Targets `ZSH` shell (now the [default since Catalina](https://support.apple.com/en-gb/HT208050)).
  7. - Produce colored output for most of shell commands.
  8. - All color schemes are based on [Monokai](https://web.archive.org/web/20161107090516/http://www.monokai.nl/blog/2006/07/). The terminal uses the [Monokai Soda](https://github.com/lysyi3m/macos-terminal-themes#monokai-soda-download) variant instead of the [official Monokai Pro terminal themes](https://monokai.pro/terminal): all Pro variants [map orange to the ANSI blue slot](https://github.com/monokai-pro/sublime-text/issues/45), which breaks any tool relying on blue semantically (`ls` directory listings, `git diff` headers, `man` highlights, `dircolors`). Monokai Soda keeps purple in the blue slot and has higher contrast on dark backgrounds.
  9. - Terminal and coding font is [Source Code Pro](https://en.wikipedia.org/wiki/Source_Code_Pro).
  10. - Keeps macOS fast, lean and secure.
  11. ## Pre-installation
  12. We will reinstall macOS from scratch.
  13. 1. Download macOS from the `App Store.app`.
  14. 2. Plug a USB drive to your machine, format it with the Disk Utility app, double-check it is mounted at `/Volumes/Untitled`, and finally [flash it with the macOS image](https://support.apple.com/en-us/HT201372):
  15. ```shell-session
  16. $ sudo /Applications/Install\ macOS\ 27\ Golden\ Gate.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --nointeraction
  17. ```
  18. 3. Reboot your machine, reinstall macOS, create a user.
  19. 4. Login to your new user, and launch `System Preferences.app`.
  20. 5. Go to `Security & Privacy` → `Privacy` → `Click the lock to make changes`, and then unlock with touch ID or password:
  21. ![](https://raw.githubusercontent.com/kdeldycke/dotfiles/main/assets/system-preferences-security-privacy-unlock.png)
  22. 6. Go to `Full Disk Access`, click the `+` button, go to `Applications` → `Utilities`, and choose `Terminal.app`:
  23. ![](https://raw.githubusercontent.com/kdeldycke/dotfiles/main/assets/terminal-full-disk-access.png)
  24. ## Install
  25. 1. First, you need a local copy of this project.
  26. If you're lucky and have `git` already installed on your machine, do:
  27. ```shell-session
  28. $ cd ~
  29. $ git clone --recursive https://github.com/kdeldycke/dotfiles.git
  30. ```
  31. If you don't have `git` yet, fetch an archive of the repository:
  32. ```shell-session
  33. $ mkdir ~/dotfiles
  34. $ cd ~/dotfiles
  35. $ curl -fsSL https://github.com/kdeldycke/dotfiles/tarball/main | tar --strip-components 1 -xvzf -
  36. ```
  37. 2. Now you can install the dotfiles on your system:
  38. ```shell-session
  39. $ cd ~/dotfiles
  40. $ /bin/zsh ./install.sh 2>&1 | tee ./install.log
  41. ```
  42. ### Stages
  43. The install procedure is decomposed into stages, executed in this order on a full run:
  44. | Stage | What it does |
  45. | :--------- | :------------------------------------------------------------------------------------------------- |
  46. | `links` | Symlink the dotfiles into the home folder. |
  47. | `packages` | macOS updates, Homebrew bootstrap, and full package restore from `packages.toml` via `mpm`. |
  48. | `shell` | Zsh plugins (zinit) and shell completions. |
  49. | `apps` | Mac App Store packages and per-application setup (QuickLook, SwiftBar, Tor Browser, IINA, Neovim). |
  50. | `cleanup` | Package caches and orphans, Trash, DNS cache. |
  51. | `snapshot` | Record the versions of installed packages into `packages.toml`. |
  52. | `config` | Apply the whole `macos-config.sh`. Kills `Terminal.app` at the end. |
  53. Each stage can be run on its own, or combined with others in the order given:
  54. ```shell-session
  55. $ ./install.sh links
  56. $ ./install.sh cleanup snapshot
  57. ```
  58. `./install.sh --list` prints the available stage names.
  59. ## Post-installation
  60. Manual setup required to finish up the perfect configuration.
  61. This is a list of manual post-installation steps required to fully configure the system. Haven't found any way to automate them all.
  62. ### `System Preferences.app`
  63. 1. In `Displays`, set external monitor scale:
  64. ![](https://raw.githubusercontent.com/kdeldycke/dotfiles/main/assets/external-display-scale.png)
  65. 2. In `Touch ID` → `Add other fingerprints`.
  66. 3. In `Security & Privacy` → `Privacy` → `Accessibility`, activate:
  67. - `Amethyst.app`
  68. - `LogiMgrDaemon`, found at `Logi Options.app/Contents/Support/LogiMgrDaemon.app`
  69. - `MonitorControl.app`
  70. ![](https://raw.githubusercontent.com/kdeldycke/dotfiles/main/assets/accessibility-preferences.png)
  71. 4. In `Security & Privacy` → `Privacy` → `Full Disk Access`, click the `+` button. Then go to `Applications` → `Utilities`, to add:
  72. - `BlockBlock.app`
  73. - `KnockKnock.app`
  74. 5. In `Security & Privacy` → `Privacy` → `Analytics & Improvements`: uncheck all options to disallow analytics sharing.
  75. ![](https://raw.githubusercontent.com/kdeldycke/dotfiles/main/assets/analytics-and-improvements-preferences.png)
  76. 6. In `Security & Privacy` → `Privacy` → `Apple Advertising`: uncheck `Personalized Ads` option.
  77. ![](https://raw.githubusercontent.com/kdeldycke/dotfiles/main/assets/apple-advertising-preferences.png)
  78. 7. In `Security & Privacy` → `Privacy` → `Developer Tools`, activate `Terminal`:
  79. ![](https://raw.githubusercontent.com/kdeldycke/dotfiles/main/assets/developer-tools-preferences.png)
  80. ### SSH
  81. Copy the SSH folder (`~/.ssh/`) from Time Machine backups. It holds the keys, which stay out of this repository: `./install.sh links` only links the shared config files into it. It also holds `config.d/`, the private host blocks that the shared `config` includes. After restoring, add the public key to GitHub as both an "Authentication key" and a "Signing key" at https://github.com/settings/keys.
  82. ### Safari
  83. In `Preferences...` → `Extensions`, activate:
  84. - `AdGuard Assistant`
  85. - `Archive Page`
  86. - `Consent-O-Matic`
  87. - `SimpleLogin`
  88. ![](https://raw.githubusercontent.com/kdeldycke/dotfiles/main/assets/safari-active-extensions.png)
  89. ### AdGuard
  90. In `Preferences...` → `Filters`, click the `+` button and subscribe to all filter lists:
  91. ![](https://raw.githubusercontent.com/kdeldycke/dotfiles/main/assets/adguard-filter-lists-subscription.png)
  92. That first pass is the only manual one. The six custom lists the registry does not offer subscribe themselves: `macos-config.sh` opens an `abp://subscribe` URL for each, which are the only steps of that script asking for a click. They are [`adguard-user-rules.txt`](adguard-user-rules.txt), the AdGuard Annoyances and DNS filters, and the three [`i5heu/ublock-hide-yt-shorts`](https://github.com/i5heu/ublock-hide-yt-shorts) lists stripping YouTube shorts, comments and playables. Each one already subscribed is skipped, so re-running the script asks only for the dialogs that were missed.
  93. AdGuard keeps its filter state in a SQLite database rather than a file, so `install.sh` cannot symlink `adguard-user-rules.txt` the way it does every other dotfile, and a subscription is the only path that updates itself: a push to `main` deploys each later edit on the next refresh. Never paste the file into the `User rules` screen: that import replaces the whole list, and the two lists have different jobs.
  94. The `User rules` screen holds the private half, and this repository carries none of it. It fills itself during ordinary browsing: the Safari AdGuard extension writes an entry there each time I switch AdGuard off for a site. So the list is disposable. A macOS reinstall starts it empty and rebuilds it site by site over a few sessions, which is why nothing here backs it up. `adguard-user-rules.txt` carries only the rules worth moving between machines, and only the ones safe to publish.
  95. Stealth Mode drops QUIC, because AdGuard cannot rewrite the SNI of a handshake it does not proxy. A host advertising `alpn=h3` in its HTTPS DNS record then stalls on UDP 443 until the browser retries over TCP, and Safari can report that stall as `This website does not support connecting securely over HTTPS`. Exempt such a host with a `$stealth` rule: an allowlist entry alone never reaches Stealth Mode. `Filtering log` names the cause, showing `Stealth mode` in the `Filter` column of a red `quic://` row.
  96. ### Claude Code
  97. `~/.claude/settings.json` is symlinked to this repo and committed. There is no global `settings.local.json`: `~/.claude/settings.local.json` is [not a supported file](https://github.com/anthropics/claude-code/issues/35703#issuecomment-4138622633).
  98. `enableWeakerNetworkIsolation: true` is set in the sandbox config to work around a macOS sandbox limitation: the sandbox blocks `Security.framework` IPC to `trustd`, breaking TLS certificate verification for all CGO-compiled Go binaries (`gh`, `terraform`, `tofu`, etc.) and Keychain access. `SSL_CERT_FILE` does not help because these binaries use `Security.framework` directly and ignore file-based certs ([anthropics/claude-code#34876](https://github.com/anthropics/claude-code/issues/34876)).
  99. Claude Code reads skills and agents from the filesystem (`~/.claude/skills/` and `~/.claude/agents/`, symlinked to this repo), but Cowork and the Desktop chat resolve them from the account-level deployment store and cannot read local files ([anthropics/claude-code#76724](https://github.com/anthropics/claude-code/issues/76724), [anthropics/claude-code#84611](https://github.com/anthropics/claude-code/issues/84611)). A plugin is what reaches those surfaces, and two catalogs cover my skills:
  100. - `kdeldycke/repomatic` carries the 19 skills and 3 agents that repository owns, which is their canonical source.
  101. - `kdeldycke/dotfiles` carries the 10 that live only here: `agent-config-self-tune`, `audit-repo-issues`, `fill-web-form`, `memory-review`, `pr-triage`, `rename-with-dates`, `session-title`, `shared-tree-commit`, `transcribe-recording` and `wrapup-session`.
  102. Add each in the Claude Desktop app under **Settings** → **Customize** → **Plugins**, through **Add** → **Add marketplace** → **Add from a repository**, then install its plugin from the **Discover** tab. Both verified on 2026-08-29 against Claude Code `2.1.236` and Desktop `1.37937.3`. Every skill then appears once, tagged with the catalog it came from:
  103. ![](https://raw.githubusercontent.com/kdeldycke/dotfiles/main/assets/claude-skills-by-plugin.png)
  104. This repository's own plugin declares its ten skills by path, and its root is the repository itself, so an install carries every other file here too: more than 100 of them, assets and workflows included. Scoping that payload would mean moving the plugin root down to `dotfiles/.agents`, where `skills/` sits at the location the spec scans and all 28 skills would likely be discovered, including the repomatic ones this catalog must not republish. The wasted files are the cheaper of the two.
  105. Keeping a catalog current on every push needs the GitHub App, which grants read and write on code, workflows, issues and pull requests, so it is worth a thought before installing. Without it a plugin still updates on request, and the app polls every 20 minutes anyway.
  106. Uploading a release archive by hand still works offline and stays the fallback: download the `repomatic-claude-plugin.zip` asset of the [latest `kdeldycke/repomatic` release](https://github.com/kdeldycke/repomatic/releases/latest) and use **Add** → **Upload plugin**. It costs an upload per release, since such a plugin reports its source as `Uploaded from file` and offers no update check. Its page shows the version from the plugin manifest (Desktop `5.1231.2`). Keep that filename version-free: the app derives the plugin name from it, and a versioned name installs a duplicate instead of updating ([anthropics/claude-code#20697](https://github.com/anthropics/claude-code/issues/20697)).
  107. Diagnose any of this from `~/Library/Logs/Claude/main.log`, never the dialog, which reports a bare "Marketplace sync failed" naming no cause. Findings are tracked in [kdeldycke/repomatic#2540](https://github.com/kdeldycke/repomatic/issues/2540).
  108. `/wrapup-session` (the shared [skill](dotfiles/.agents/skills/wrapup-session/SKILL.md)) closes out a session: loose ends, then lessons worth persisting. Claude Code cannot quit after a turn, so run it by hand before exiting; a [`SessionEnd` hook](dotfiles/.claude/hooks/wrapup-session-nudge.py) prints a reminder when an interactive exit skipped it.
  109. ### Pi
  110. `~/.pi/agent/settings.json` is symlinked to this repo and committed. Session logs, auth tokens and model caches stay local to the machine.
  111. pi has no permission layer, so the [`shell-deny.ts` extension](dotfiles/.pi/agent/extensions/shell-deny.ts) applies the `Bash(...)` deny rules of the Claude Code `settings.json` to pi's `bash` tool. One list then stops both agents.
  112. `/bye` (from the [`bye.ts` extension](dotfiles/.pi/agent/extensions/bye.ts)) runs the shared [`wrapup-session` skill](dotfiles/.agents/skills/wrapup-session/SKILL.md) as a final turn, then quits once it settles. A plain `/quit` or Ctrl+D prints a one-line reminder instead.
  113. ### Logi Options
  114. For productivity, setup custom trackball shortcuts with macOS desktop management tools and Amethyst windows commands.
  115. Page-up button assignment → `Smart zoom`:
  116. ![](https://raw.githubusercontent.com/kdeldycke/dotfiles/main/assets/logitech-mx-ergo-page-up.png)
  117. Page-down button assignment → `Shift` + `Opt` + `Ctrl` + `J`:
  118. ![](https://raw.githubusercontent.com/kdeldycke/dotfiles/main/assets/logitech-mx-ergo-page-down.png)
  119. Wheel click button assignment → `Mission Control`:
  120. ![](https://raw.githubusercontent.com/kdeldycke/dotfiles/main/assets/logitech-mx-ergo-wheel-click.png)
  121. Wheel left click assignment → `Desktop (left)`:
  122. ![](https://raw.githubusercontent.com/kdeldycke/dotfiles/main/assets/logitech-mx-ergo-wheel-left.png)
  123. Wheel right click assignment → `Desktop (right)`:
  124. ![](https://raw.githubusercontent.com/kdeldycke/dotfiles/main/assets/logitech-mx-ergo-wheel-right.png)
  125. Side button assignment → `Shift` + `Opt` + `Space`:
  126. ![](https://raw.githubusercontent.com/kdeldycke/dotfiles/main/assets/logitech-mx-ergo-side-button.png)
  127. Side button assignment → `Shift` + `Opt` + `Space`:
  128. ![](https://raw.githubusercontent.com/kdeldycke/dotfiles/main/assets/logitech-mx-ergo-side-button.png)
  129. ## Upgrade
  130. I'm trying to make the install procedure idempotent so you'll just have to call the script again to upgrade your system:
  131. ```shell-session
  132. $ ./install.sh 2>&1 | tee ./install.log
  133. ```
  134. To refresh only a part of the system, call the corresponding [stage](#stages), like `./install.sh packages` to upgrade packages without touching the rest.
  135. ## Maintenance
  136. It mainly consist in refreshing some assets at every macOS major release:
  137. - Regenerate [`Monokai Soda.terminal` profile](https://github.com/kdeldycke/dotfiles/blob/main/assets/Monokai%20Soda.terminal).
  138. - Keep list of packages up-to-date:
  139. ```shell-session
  140. $ ./install.sh snapshot
  141. ```
  142. - Update screenshots. 😖
  143. - Run the [security audit](#security-audit) below.
  144. ### Security audit
  145. At every macOS major release, I audit `macos-config.sh` against the [NIST macOS Security Compliance Project](https://github.com/usnistgov/macos_security) (mSCP) to catch security settings that the new release moved, renamed or retired. Security-related lines in the script are tagged with their stable mSCP rule id (like `system_settings_firewall_enable`) so a failing rule maps straight back to the line to update.
  146. 1. Clone the mSCP guidance for the macOS release. macOS 27 has no release branch: its guidance is in the `release_27.0` tag. Older releases have a branch named after the release (`tahoe` for macOS 26, `sequoia` for macOS 15, and so on):
  147. ```shell-session
  148. $ git clone --branch release_27.0 --depth 1 https://github.com/usnistgov/macos_security.git
  149. $ cd macos_security
  150. ```
  151. 2. Build a tailored CIS level 1 baseline. The interactive prompts let me exclude the deliberate exemptions listed below and set my own organization-defined values (like the 600 seconds screen saver timeout, the 30 days audit retention, or `time.euro.apple.com` as time server):
  152. ```shell-session
  153. $ uv run --with-requirements requirements.txt scripts/generate_baseline.py --keyword cis_lvl1 --tailor
  154. ```
  155. 3. Generate the compliance script from the tailored baseline and run it in check-only mode:
  156. ```shell-session
  157. $ uv run --with-requirements requirements.txt scripts/generate_guidance.py --script custom/baselines/cis_lvl1_macos_27.0.yaml
  158. $ sudo zsh build/cis_lvl1_macos_27.0/cis_lvl1_macos_27.0_compliance.sh --check
  159. $ sudo zsh build/cis_lvl1_macos_27.0/cis_lvl1_macos_27.0_compliance.sh --stats
  160. ```
  161. 4. Reconcile every failing rule: port the rule's `fix` command into `macos-config.sh` (tagged with its mSCP rule id), or add the rule to the exemption list below. Then re-run `macos-config.sh` and check again: macOS upgrades silently reset some settings (launchd service overrides and `pmset` values in particular), and re-running the script is the intended remedy. Rules marked "implemented by a Configuration Profile" have no CLI equivalent: generate the profiles with `--profiles` (or `--consolidated-profile`) and import them via `System Settings.app` → `Privacy & Security` → `Profiles`.
  162. Deliberate exemptions, to exclude when tailoring the baseline:
  163. - `os_airdrop_disable`: AirDrop stays enabled, on all interfaces.
  164. - `os_gatekeeper_enable`: Gatekeeper assessments stay on, but I disable the `LSQuarantine` prompt, and the `SIP_DISABLED` branch of the script adds a Developer Tools bypass for Terminal.
  165. - `os_handoff_disable`: Handoff between my devices stays enabled.
  166. - `os_loginwindow_adminhostinfo_disabled`: I show the hostname at the login window on purpose.
  167. - `pwpolicy_*`: no password lockout, history or rotation policy on a personal machine.
  168. - `system_settings_firewall_enable` and `system_settings_firewall_stealth_mode_enable`: enforced with `socketfilterfw` instead of a configuration profile, so the check (which reads the managed preference) can report a false failure while the firewall is actually on.
  169. Rules that stay check-only without an MDM, to carry into the generated configuration profile instead of `macos-config.sh`: `os_mail_summary_disable`, `os_notes_transcription_disable`, `os_notes_transcription_summary_disable`, `os_on_device_dictation_enforce`, `os_software_update_deferral`, `os_writing_tools_disable`, `system_settings_external_intelligence_disable` and `system_settings_external_intelligence_sign_in_disable`. A few others (Siri, AirPlay receiver, Internet Sharing) are set by `macos-config.sh` through their real preference keys, but only the corresponding profile payload prevents re-enablement. `system_settings_time_machine_encrypted_configure` stays manual: encryption is picked when selecting the backup disk.
  170. ## Versions
  171. Only the current default `main` branch is supported and actively maintained. Older branches are available for archive.
  172. - [macOS 27 (Golden Gate)](https://github.com/kdeldycke/dotfiles/tree/main) (current)
  173. - [macOS 26 (Tahoe)](https://github.com/kdeldycke/dotfiles/tree/macos-26)
  174. - [macOS 15 (Sequoia)](https://github.com/kdeldycke/dotfiles/tree/macos-15)
  175. - [macOS 14 (Sonoma)](https://github.com/kdeldycke/dotfiles/tree/macos-14)
  176. - [macOS 13 (Ventura)](https://github.com/kdeldycke/dotfiles/tree/macos-13)
  177. - [macOS 12 (Monterey)](https://github.com/kdeldycke/dotfiles/tree/macos-12)
  178. - [macOS 11 (Big Sur)](https://github.com/kdeldycke/dotfiles/tree/macos-11)
  179. - [macOS 10.15 (Catalina)](https://github.com/kdeldycke/dotfiles/tree/macos-10.15)
  180. - [macOS 10.14 (Mojave)](https://github.com/kdeldycke/dotfiles/tree/macos-10.14)
  181. - [macOS 10.13 (High Sierra)](https://github.com/kdeldycke/dotfiles/tree/macos-10.13)
  182. - [macOS 10.12 (Sierra)](https://github.com/kdeldycke/dotfiles/tree/macos-10.12)
  183. Former [support of Kubuntu and Ubuntu Server Linux distributions has been dropped](https://github.com/kdeldycke/dotfiles/commit/e667245f6a4c90c6d41907e392adb74c5acfcf13). You can still find these as dedicated branches, but all are quite ancient (2016).
  184. ## Resources
  185. - [`ingrino`'s dotfiles](https://github.com/lingrino/dotfiles)
  186. - [Mathias Bynens `.macos`](https://github.com/mathiasbynens/dotfiles/blob/master/.macos)
  187. ## License
  188. For convenience, some third party code and assets are hard-copied in place. These particular items have their own license and copyright:
  189. - [Monokai Soda](https://github.com/lysyi3m/macos-terminal-themes#monokai-soda-download).
  190. The rest of the content is configuration and code I accumulated over years. Some was heavily inspired by other dotfiles repositories. But each time I borrow something, I try to credit the author and/or point to the source. You should be able to trace back the origin of things by looking at the commit history.
  191. If you can't find any clue about an external source, then assume it is original content I produced, which I released under the [BSD 2-Clause License](LICENSE.md).
install.sh · Bundled script · 543 lines · 1 finding marked
  1. #!/usr/bin/env zsh
  2. set -Eeuxo pipefail
  3. ######### Survey mode #########
  4. # `set -e` stops at the first failing command, so a CI run reports exactly one
  5. # problem however many it holds. That is affordable for a short script and not
  6. # for this one: macos-config.sh alone is over 2200 lines, had never executed
  7. # past its first few hundred on a runner, and every macOS deprecation hiding in
  8. # the rest costs a full 30-to-50-minute workflow to reach. `lsregister -kill`
  9. # and `systemsetup -setremoteappleevents` each burned one that way.
  10. #
  11. # With SURVEY=1 the run keeps going and records every command that would have
  12. # aborted it, so one pass enumerates the lot. Nothing is forgiven: the report
  13. # at the end returns non-zero while any failure was recorded, and the run stays
  14. # red. Off by default, since a real install must still stop at the first sign
  15. # of trouble rather than plough on through a broken state.
  16. # Record the file and line of the command that just failed, given the `LINENO`
  17. # the trap read. That number restarts at 1 inside a function, and every stage
  18. # is a function, so it is added to the line where the function starts.
  19. # `funcsourcetrace` holds that start as `file:line`, and as `file:0` for a
  20. # sourced file, which keeps a failure in macos-config.sh on its own line there.
  21. # Entry 1 is this function, so entry 2 is the code that failed.
  22. survey_record() {
  23. local frame="${funcsourcetrace[2]:-}"
  24. # A file, not an array: the trap fires inside loops and command
  25. # substitutions, and a subshell's array append dies with the subshell.
  26. if [[ -n "${frame}" ]]; then
  27. print -r -- "${frame%:*}:$(( ${frame##*:} + $1 ))" >> "${SURVEY_LOG}"
  28. else
  29. # No calling frame: the command is at the top level of this script.
  30. print -r -- "${(%):-%x}:$1" >> "${SURVEY_LOG}"
  31. fi
  32. }
  33. if (( ${SURVEY:-0} )); then
  34. set +e
  35. : ${SURVEY_LOG:="${TMPDIR:-/tmp}/dotfiles-survey.log"}
  36. export SURVEY_LOG
  37. : > "${SURVEY_LOG}"
  38. trap 'survey_record "${LINENO}"' ERR
  39. fi
  40. # Print every command the survey caught, then fail if there was any.
  41. survey_report() {
  42. (( ${SURVEY:-0} )) || return 0
  43. # Stop recording first. This function ends on a deliberate non-zero return,
  44. # which the trap would otherwise append to the very log it just printed.
  45. trap - ERR
  46. if [[ ! -s "${SURVEY_LOG}" ]]; then
  47. echo "=== Survey: no command failed ==="
  48. return 0
  49. fi
  50. echo "=== Survey: commands that would have aborted the run ==="
  51. local count entry file line
  52. # Collapsed by line: a failure inside a loop fires once per iteration, and
  53. # the same line listed forty times is still one thing to fix.
  54. sort "${SURVEY_LOG}" | uniq -c | sort -k2,2 | while read -r count entry; do
  55. file="${entry%:*}"
  56. line="${entry##*:}"
  57. printf '%s:%s (x%s)\n %s\n' \
  58. "${file:t}" "${line}" "${count}" "$(sed -n "${line}p" "${file}")"
  59. done
  60. echo "=== $(sort -u "${SURVEY_LOG}" | wc -l | tr -d ' ') distinct failures ==="
  61. return 1
  62. }
  63. ######### Stage selection #########
  64. # The install procedure is decomposed into stages, each runnable on its own:
  65. # ./install.sh Full run: every stage, in the order below.
  66. # ./install.sh links A single stage.
  67. # ./install.sh cleanup snapshot Several stages, in the order given.
  68. # ./install.sh --list Print available stage names.
  69. STAGES=(links packages shell apps cleanup snapshot config)
  70. if [[ "${1:-}" == "--list" ]]; then
  71. print -l "${STAGES[@]}"
  72. exit 0
  73. fi
  74. # Reject unknown stage names before any check or side effect below.
  75. for stage ("$@"); do
  76. if (( ! ${STAGES[(Ie)${stage}]} )); then
  77. echo "Unknown stage: ${stage}. Available stages: ${STAGES[*]}" >&2
  78. exit 2
  79. fi
  80. done
  81. run_stages=("$@")
  82. (( ${#run_stages} )) || run_stages=("${STAGES[@]}")
  83. ######### Pre-checks #########
  84. # Detect platform.
  85. if [ "$(uname -s)" != "Darwin" ]; then
  86. echo "These dotfiles only targets macOS."
  87. exit 1
  88. fi
  89. # Check current shell interpreter. A standalone pipeline + $? check would be
  90. # aborted by set -e before reaching the test: keep the pipeline in the condition.
  91. if ! ps -p $$ | grep --quiet "zsh"; then
  92. echo "These dotfiles were tested with Zsh shell only."
  93. exit 1
  94. fi
  95. # Check if SIP is going to let us mess with some part of the system.
  96. if csrutil status 2>/dev/null | grep --quiet "enabled"; then
  97. SIP_DISABLED=0
  98. echo "System Integrity Protection (SIP) is enabled."
  99. else
  100. SIP_DISABLED=1
  101. echo "System Integrity Protection (SIP) is disabled."
  102. fi
  103. # Use system, BSD find command. Shared by the links and apps stages.
  104. FIND_CLI="/usr/bin/find"
  105. ######### Sudo keep-alive #########
  106. # Source: https://gist.github.com/cowboy/3118588
  107. # Ask for the administrator password upfront.
  108. # Ignore the following error returns within GitHub actions workflows:
  109. # sudo: a terminal is required to read the password; either use the -S option to
  110. # read from standard input or configure an askpass helper
  111. sudo --validate || true
  112. # Update existing `sudo` time stamp until script has finished.
  113. while true; do sleep 60; sudo --non-interactive true; kill -0 "$$" || exit; done 2> /dev/null &
  114. ######### Stage: links #########
  115. # Symlink dotfiles in user's home.
  116. stage_links() {
  117. # Collect all entries within the "dotfiles" sub-folder, but the "Library",
  118. # ".config", ".pi", ".claude", ".agents", ".gnupg" and ".ssh".
  119. #
  120. # ".claude" and ".agents" are excluded for the same reason as LaunchAgents
  121. # below: ~/.claude is a real directory Claude Code writes its own runtime
  122. # state into (sessions, history.jsonl, projects, telemetry). Linking the
  123. # folder would move all of that aside into a backup and drop the live state
  124. # inside this git repository, so its contents are linked entry by entry.
  125. #
  126. # ".gnupg" and ".ssh" are excluded for the same reason, and the stakes are
  127. # higher: both hold private keys. gpg writes its keys into
  128. # ~/.gnupg/private-keys-v1.d and opens its agent sockets there, and ssh
  129. # keeps its id_* keys, known_hosts files and agent sockets in ~/.ssh.
  130. # Linking either folder puts that material inside this git working tree,
  131. # where only ignore rules keep it out of a commit, and where an agent
  132. # sandbox that opens ~/code can read and overwrite it. Only their tracked
  133. # files are linked, by name, below.
  134. DOT_FILES=$($FIND_CLI dotfiles -depth 1 -not -name '\.DS_Store' -not -name 'Library' -not -name '.config' -not -name '.pi' -not -name '.claude' -not -name '.agents' -not -name '.gnupg' -not -name '.ssh')
  135. # Collect all ".config" content .
  136. DOT_FILES+="
  137. $($FIND_CLI dotfiles/.config -depth 1 -not -name '\.DS_Store')"
  138. # Collect all "Library" subfolders but "Application Support", "Preferences"
  139. # and "LaunchAgents" folders. LaunchAgents is excluded for the same reason
  140. # as the others: ~/Library/LaunchAgents is a real directory holding agents
  141. # this repository does not own (Google Updater, anything
  142. # `brew services` installs). Linking the folder would move all of them
  143. # aside into a backup and silently stop them, so its contents are linked
  144. # file by file below.
  145. DOT_FILES+="
  146. $($FIND_CLI dotfiles/Library -depth 1 -not -name '\.DS_Store' -not -name 'Application Support' -not -name 'Preferences' -not -name 'LaunchAgents')"
  147. # Collect all "Preferences" subfolders.
  148. DOT_FILES+="
  149. $($FIND_CLI dotfiles/Library/Preferences -depth 1 -not -name '\.DS_Store')"
  150. # Collect all "Application Support" subfolders but "Code" folder.
  151. DOT_FILES+="
  152. $($FIND_CLI 'dotfiles/Library/Application Support' -depth 1 -not -name '\.DS_Store' -not -name 'Code')"
  153. # Manually add Code, Pi, LaunchAgents, agent-tooling, GnuPG and SSH files.
  154. #
  155. # The ".claude" and ".agents" entries are what keeps ~/.claude a real
  156. # directory: each lands beside the state Claude Code owns instead of
  157. # replacing the folder holding it. The loop always names a link after its
  158. # source, so it leaves out the links named otherwise: ~/.claude/CLAUDE.md
  159. # and ~/.pi/agent/AGENTS.md, created after the loop, and ~/.claude/skills (a
  160. # second link to .agents/skills, already linked into ~/.agents/skills
  161. # below), which stays hand-maintained.
  162. #
  163. # .pi/agent/APPEND_SYSTEM.md is a link inside this repository, to
  164. # .claude/tropes.md. pi expands no "@" import in AGENTS.md, so the tropes
  165. # reach it as an appended system prompt instead.
  166. DOT_FILES+="
  167. dotfiles/Library/Application Support/Code/User/settings.json
  168. dotfiles/Library/LaunchAgents/com.kdeldycke.clamdscan.plist
  169. dotfiles/.pi/agent/APPEND_SYSTEM.md
  170. dotfiles/.pi/agent/models.json
  171. dotfiles/.pi/agent/settings.json
  172. dotfiles/.pi/agent/extensions
  173. dotfiles/.pi/agent/themes
  174. dotfiles/.agents/skills
  175. dotfiles/.claude/agents
  176. dotfiles/.claude/output-styles
  177. dotfiles/.claude/settings.json
  178. dotfiles/.claude/tropes.md
  179. dotfiles/.gnupg/dirmngr.conf
  180. dotfiles/.gnupg/gpg-agent.conf
  181. dotfiles/.ssh/allowed_signers
  182. dotfiles/.ssh/config
  183. dotfiles/.ssh/ssh-keygen-secretive
  184. dotfiles/.ssh/utm-host.py"
  185. echo "Collected dotfiles:"
  186. echo "${DOT_FILES}" | sort
  187. for FILEPATH (${(f)DOT_FILES}); do
  188. DESTINATION="${PWD}/${FILEPATH}"
  189. LINK="${HOME}/${FILEPATH#*/}"
  190. CURRENT_LINK="$(readlink "${LINK}" || true)"
  191. if [[ "${CURRENT_LINK}" != "${DESTINATION}" ]]; then
  192. # When the parent folder links into this repository, ${LINK} is
  193. # the source file itself: the backup below would move it aside and
  194. # ln would link it onto itself. Stop instead of converting the
  195. # folder here, since it can hold private keys to move by hand.
  196. if [[ "${LINK:h:A}" == "${DESTINATION:h:A}" ]]; then
  197. echo "${LINK:h} links into this repository: replace it with a real directory holding its untracked files, then re-run." >&2
  198. exit 1
  199. fi
  200. # Something (a link, a file, a directory...) already exists. Back it up.
  201. if [[ -e "${LINK}" ]]; then
  202. EXT=".dotfiles.bak"
  203. INC=0
  204. BACKUP="${LINK}${EXT}${INC}"
  205. # -e, not -f: backed-up entries can be directories (~/.gnupg,
  206. # ~/.claude, ...). -f never matches a directory, so the counter
  207. # would stall and mv would drop the next backup inside the previous
  208. # one instead of beside it.
  209. while [ -e "${BACKUP}" ]; do
  210. # += instead of ++: a post-increment from 0 evaluates to 0,
  211. # whose non-zero exit status trips set -e.
  212. (( INC += 1 ))
  213. BACKUP="${LINK}${EXT}${INC}"
  214. done
  215. echo "Backup: ${LINK} -> ${BACKUP}"
  216. mv "${LINK}" "${BACKUP}"
  217. fi
  218. echo "Create link: ${LINK} -> ${DESTINATION}"
  219. # Create missing directory structure if missing.
  220. LINK_FOLDER="$(dirname "${LINK}")"
  221. mkdir -p "${LINK_FOLDER}"
  222. # Force symbolic link (re-)creation. It either doesn't exist or point to the wrong place.
  223. ln -sf "${DESTINATION}" "${LINK_FOLDER}"
  224. fi
  225. done
  226. # The global instructions, which the loop above cannot link: Claude Code
  227. # reads them as ~/.claude/CLAUDE.md and pi as ~/.pi/agent/AGENTS.md, and
  228. # neither name is the source's. A link that already resolves to the source
  229. # stays as it is, relative or absolute. A regular file is never replaced: an
  230. # editor writing through the home path forks the file that way, and the
  231. # fork may hold edits the source lacks.
  232. GLOBAL_INSTRUCTION="${PWD}/dotfiles/.agents/global-instruction.md"
  233. if [[ ! -f "${GLOBAL_INSTRUCTION}" ]]; then
  234. echo "Missing source: ${GLOBAL_INSTRUCTION}" >&2
  235. exit 1
  236. fi
  237. for LINK in "${HOME}/.claude/CLAUDE.md" "${HOME}/.pi/agent/AGENTS.md"; do
  238. if [[ -L "${LINK}" && "${LINK:A}" == "${GLOBAL_INSTRUCTION:A}" ]]; then
  239. continue
  240. fi
  241. if [[ -e "${LINK}" && ! -L "${LINK}" ]]; then
  242. echo "${LINK} is a regular file: merge it into ${GLOBAL_INSTRUCTION}, remove it, then re-run." >&2
  243. exit 1
  244. fi
  245. echo "Create link: ${LINK} -> ${GLOBAL_INSTRUCTION}"
  246. mkdir -p "${LINK:h}"
  247. ln -sfn "${GLOBAL_INSTRUCTION}" "${LINK}"
  248. done
  249. # On a machine with no ~/.gnupg or ~/.ssh yet, the loop above creates them
  250. # with the default umask while linking files into them. gpg then
  251. # warns on every run that its home directory is readable by others, and
  252. # both hold private keys, so tighten them here rather than leaving each new
  253. # machine to be fixed by hand.
  254. chmod 700 "${HOME}/.gnupg" "${HOME}/.ssh"
  255. }
  256. ######### Stage: packages #########
  257. # OS updates, Homebrew bootstrap and the full package restore via mpm.
  258. stage_packages() {
  259. # Command line tools provides a copy of git.
  260. xcode-select --install || true
  261. # Install recommended macOS updates only: --all can also stage a
  262. # reboot-wanting OS upgrade in the middle of the bootstrap.
  263. #
  264. # Skipped on GitHub runners. The image is discarded at the end of the job,
  265. # so patching it buys nothing, and --recommended still pulls whole
  266. # multi-gigabyte point releases ("Downloading macOS Tahoe 26.6.1"): that
  267. # download was both the longest step of the run and, since softwareupdate
  268. # has no verbosity flag and prints one line per progress tick off a TTY,
  269. # the bulk of the log.
  270. if (( ! ${+GITHUB_WORKFLOW} )); then
  271. sudo softwareupdate --install --recommended
  272. fi
  273. # Check if homebrew is already installed. See: https://unhexium.net/zsh/how-to-check-variables-in-zsh/
  274. # This also install xcode command line tools.
  275. if (( ! ${+commands[brew]} )); then
  276. # Install Homebrew without prompting for user confirmation.
  277. NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  278. fi
  279. # Activate brew analytics in GitHub actions, to prevent overzealous maintainers for
  280. # removing perfectly working packages on the pretense nobody uses them.
  281. if (( ! ${+GITHUB_WORKFLOW} )); then
  282. brew analytics on
  283. else
  284. brew analytics off
  285. fi
  286. # Refresh our local copy of package index.
  287. brew update
  288. # Fetch latest packages.
  289. brew upgrade
  290. # Add taps.
  291. brew tap smudge/smudge
  292. brew tap jorgelbg/tap
  293. # Trust the specific third-party formulae I install from untrusted taps.
  294. brew trust --formula smudge/smudge/nightlight
  295. # pinentry-touchid is not in homebrew-core: it clears the notability bar on
  296. # stars but not the "actively maintained upstream" one, its last release
  297. # being v0.0.3 in 2022. It is what releases the GPG passphrase behind Touch
  298. # ID, so signing falls back to typing it by hand without this.
  299. brew trust --formula jorgelbg/tap/pinentry-touchid
  300. brew install "python@3.14"
  301. # Install mpm.
  302. brew install meta-package-manager
  303. # Refresh all package managers.
  304. mpm --verbosity INFO sync
  305. # Install all my packages but skip [mas] section (there is a circular
  306. # dependency as mas needs to be install by brew first).
  307. # XXX This edge-case should be taken care of upstream by mpm.
  308. mpm --verbosity INFO --no-mas restore ./packages.toml
  309. }
  310. ######### Stage: shell #########
  311. # Zsh plugins and completions.
  312. stage_shell() {
  313. # Install zinit
  314. sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh)"
  315. # Fix "zsh compinit: insecure directories" error.
  316. sudo chown -R $(whoami) "$(brew --prefix)/share/zsh" "$(brew --prefix)/share/zsh/site-functions"
  317. chmod u+w "$(brew --prefix)/share/zsh" "$(brew --prefix)/share/zsh/site-functions"
  318. # Generate pip and mpm completion. macOS ships no unversioned python binary.
  319. python3 -m pip completion --zsh > ~/.zfunc/_pip
  320. _MPM_COMPLETE=zsh_source mpm > ~/.zfunc/_mpm
  321. # Force zinit self-upgrade. Run in an interactive child shell, where .zshrc
  322. # defines the zinit function.
  323. zsh -ic "zinit self-update && zinit delete --clean --yes && zinit update"
  324. }
  325. ######### Stage: apps #########
  326. # Mac App Store packages and per-application setup.
  327. stage_apps() {
  328. # htop-osx requires root privileges to correctly display all running processes.
  329. sudo chown root:wheel "$(brew --prefix)/bin/htop"
  330. sudo chmod u+s "$(brew --prefix)/bin/htop"
  331. # Upgrade all desktop apps. Skipped on GitHub runners: mas needs an Apple ID
  332. # interactively signed into the App Store app, which hosted runners don't
  333. # have, so every install hangs until mpm's per-package timeout and fails.
  334. if (( ! ${+GITHUB_WORKFLOW} )); then
  335. mpm --mas --verbosity INFO restore ./packages.toml
  336. fi
  337. # Remove unused apps. Two things make this fail quietly, and the `|| true`
  338. # that covers an already-removed app swallows both:
  339. # - `mas uninstall` needs root to delete a bundle out of /Applications.
  340. # The sudo keep-alive above keeps this non-interactive.
  341. # - mas resolves installed apps through Spotlight, so a bundle that is
  342. # present but unindexed fails as "No installed apps with ADAM ID". That
  343. # is how GarageBand survived every pass. mas indexes what it finds as it
  344. # runs, but the index lands too late for that same invocation.
  345. sudo mas uninstall 682658836 || true # GarageBand
  346. sudo mas uninstall 409201541 || true # Pages
  347. # Open apps so I'll not forget to login. Skipped on GitHub runners: there is
  348. # nobody there to log in, and an app that stops on a first-launch system
  349. # prompt (ProtonVPN asks to approve its VPN configuration) never finishes
  350. # launching, so `open -a` blocks until the job hits its timeout. The
  351. # trailing `|| true` only covers a missing app, not a hang.
  352. if (( ! ${+GITHUB_WORKFLOW} )); then
  353. APP_NAMES="
  354. adguard
  355. ProtonVPN
  356. "
  357. for APP_NAME (${(f)APP_NAMES})
  358. do
  359. # Do not fail on missing app
  360. open -a "${APP_NAME}" || true
  361. done
  362. fi
  363. # Clear plugin cache
  364. qlmanage -r
  365. qlmanage -r cache
  366. # Configure SwiftBar. The plugin folder is kept out of ~/Library/Application
  367. # Support/SwiftBar, which is SwiftBar's own data directory: it writes its
  368. # diagnostics reports there and gives every plugin a state folder under
  369. # Plugins/. Scanning that tree makes SwiftBar load its own output as
  370. # plugins, which is how a system report ended up in the menu bar.
  371. # ~/.swiftbar is the alternative SwiftBar itself looks for, and it keeps the
  372. # app's state out of this repository.
  373. BAR_PLUGINS_FOLDER="${HOME}/.swiftbar"
  374. mkdir -p "${BAR_PLUGINS_FOLDER}"
  375. ln -sf "$(mpm --bar-plugin-path)" "${BAR_PLUGINS_FOLDER}/meta_package_manager.7h.py"
  376. chmod +x "${BAR_PLUGINS_FOLDER}/"*.(sh|py|rb)
  377. # A running app rewrites its preferences from memory when it quits, so the
  378. # write below has to land while SwiftBar is stopped. The `open -a` further
  379. # down brings it back. `|| true` covers a SwiftBar that was never started,
  380. # which is the case on a fresh machine and on a GitHub runner.
  381. killall SwiftBar || true
  382. defaults write com.ameba.SwiftBar PluginDirectory -string "${BAR_PLUGINS_FOLDER}"
  383. # The rest of this stage seeds an app's profile by launching it, so it needs
  384. # a real login session and is skipped on GitHub runners. Without a session
  385. # the apps never come up and every step below takes the script down with it
  386. # under `set -e`: `killall` exits non-zero when its target never started,
  387. # and the `find` for the Tor profile exits non-zero when the directory that
  388. # launch was supposed to create is missing, which also leaves TB_CONFIG_DIR
  389. # empty and points the writes below at the filesystem root.
  390. if (( ! ${+GITHUB_WORKFLOW} )); then
  391. open -a SwiftBar
  392. # Open Tor Browser at least once in the background to create a default profile.
  393. # Then close it after a while to not block script execution.
  394. open --wait-apps -g -a "Tor Browser" & sleep 20s; killall "firefox"
  395. # Show TorBrowser bookmark toolbar.
  396. TB_CONFIG_DIR=$($FIND_CLI "${HOME}/Library/Application Support/TorBrowser-Data/Browser" -maxdepth 1 -iname "*.default")
  397. # Heredoc body and its EOF stay unindented: `<<-` strips leading tabs
  398. # only, so an indented terminator would never close the document.
  399. tee -a "$TB_CONFIG_DIR/xulstore.json" <<-EOF
  400. {"chrome://browser/content/browser.xhtml": {
  401. "PersonalToolbar": {"collapsed": "false"}
  402. }}
  403. EOF
  404. # Set TorBrowser bookmarks in toolbar.
  405. # Source: https://yro.slashdot.org/story/16/06/08/151245/kickasstorrents-enters-the-dark-web-adds-official-tor-address
  406. # Entries stay unindented: leading blanks would end up in the values.
  407. BOOKMARKS="
  408. https://protonmailrmez3lotccipshtkleegetolb73fuirgj7r4o4vfu7ozyd.onion,ProtonMail,ehmwyurmkort,eqeiuuEyivna
  409. http://piratebayo3klnzokct3wt5yyxb2vpebbuyjl7m623iaxmqhsd52coid.onion,PirateBay,nnypemktnpya,dvzeeooowsgx
  410. "
  411. TB_BOOKMARK_DB="$TB_CONFIG_DIR/places.sqlite"
  412. # Remove all bookmarks from the toolbar.
  413. sqlite3 -echo -header -column "$TB_BOOKMARK_DB" "DELETE FROM moz_bookmarks WHERE parent=(SELECT id FROM moz_bookmarks WHERE guid='toolbar_____'); SELECT * FROM moz_bookmarks;"
  414. # Add bookmarks one by one.
  415. for BM_INFO (${(f)BOOKMARKS})
  416. do
  417. BM_URL=$(echo $BM_INFO | cut -d',' -f1)
  418. BM_TITLE=$(echo $BM_INFO | cut -d',' -f2)
  419. BM_GUID1=$(echo $BM_INFO | cut -d',' -f3)
  420. BM_GUID2=$(echo $BM_INFO | cut -d',' -f4)
  421. sqlite3 -echo -header -column "$TB_BOOKMARK_DB" "INSERT OR REPLACE INTO moz_places(url, hidden, guid, foreign_count) VALUES('$BM_URL', 0, '$BM_GUID1', 1); INSERT OR REPLACE INTO moz_bookmarks(type, fk, parent, title, guid) VALUES(1, (SELECT id FROM moz_places WHERE guid='$BM_GUID1'), (SELECT id FROM moz_bookmarks WHERE guid='toolbar_____'), '$BM_TITLE', '$BM_GUID2');"
  422. done
  423. sqlite3 -echo -header -column "$TB_BOOKMARK_DB" "SELECT * FROM moz_bookmarks; SELECT * FROM moz_places;"
  424. # Force installation of Firefox plugins.
  425. # For privacy extensions, see: https://github.com/arkenfox/user.js/wiki/4.1-Extensions
  426. wget https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/addon-607454-latest.xpi -O "$TB_CONFIG_DIR/extensions/uBlock0@raymondhill.net.xpi"
  427. # Open IINA at least once in the background to let it register its Safari extension.
  428. # Then close it after a while to not block script execution.
  429. # This also pop-up a persistent, but non-blocking dialog:
  430. # "XXX.app is an app downloaded from the Internet. Are you sure you want to open it?"
  431. open --wait-apps -g -a "IINA" & sleep 20s; killall "IINA"
  432. fi
  433. # Force Neovim plugin upgrades. vim.pack.update() opens a confirmation
  434. # buffer for review, so force=true is required to apply them unattended.
  435. nvim --headless -c "lua vim.pack.update(nil, { force = true })" -c "qall!"
  436. }
  437. ######### Stage: cleanup #########
  438. # Package caches, orphans, trash and DNS cache.
  439. stage_cleanup() {
  440. mpm --verbosity INFO cleanup
  441. brew services cleanup
  442. # Empty the Trash on the startup disk and all mounted volumes.
  443. trash=(~/.Trash/*(N) /Volumes/*/.Trashes/*(N))
  444. (( ${#trash} )) && rm -rf "${trash[@]}" || true
  445. # Flush the DNS resolver cache.
  446. sudo dscacheutil -flushcache
  447. sudo killall -HUP mDNSResponder
  448. }
  449. ######### Stage: snapshot #########
  450. # Record the versions of currently installed packages into packages.toml.
  451. stage_snapshot() {
  452. mpm --verbosity INFO snapshot --update-version ./packages.toml
  453. }
  454. ######### Stage: config #########
  455. # Apply the full macOS configuration. Warning: kills Terminal at the end.
  456. stage_config() {
  457. export SIP_DISABLED
  458. source ./macos-config.sh
  459. unset SIP_DISABLED
  460. }
  461. ######### Stage driver #########
  462. for stage ("${run_stages[@]}"); do
  463. echo "=== Stage: ${stage} ==="
  464. "stage_${stage}"
  465. done
  466. # Last command on purpose: its status becomes the script's, so a survey run
  467. # that recorded anything exits non-zero. A no-op outside survey mode.
  468. survey_report

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.