β„‚π• π•Ÿπ•₯π•šπ•Ÿπ•¦π•¦π•ž

CotEditor .zshrc Save Bug β€” Cleanup Steps

Last update: 2026-07-05

Tags: code

CotEditor (confirmed on 7.0.5, macOS 26.5.2) fails to save extensionless dotfiles like ~/.zshrc. When the save fails, CotEditor leaves behind an orphaned sandbox temp file that is hard-linked to the original. That orphan then blocks all subsequent save attempts by any app (including TextEdit) until it’s manually removed.

Console.app shows the underlying denial:

Sandbox: CotEditor(PID) deny(1) file-write-create /Users/<user>/.zshrc.sh

CotEditor’s atomic-save picks a temp filename based on detected syntax (shell script β†’ .sh), and the sandbox denies creating that mismatched-extension temp file. The failed attempt doesn’t clean up after itself, leaving a stray hard link behind.

Diagnostic / Cleanup Steps

1. Check for stray linked files

find ~ -samefile ~/.zshrc

A healthy file returns only .zshrc itself. If there are extra results like .zshrc.sb-XXXXXXXX-XXXXXX, those are orphaned sandbox temp files.

ls -la ~/.zshrc

Look at the number right before the owner name (user1). It should be 1. Anything higher means stray links exist.

3. Remove the stray files

rm ~/.zshrc.sb-*

(Adjust the glob if find showed a different naming pattern.)

4. Verify cleanup

find ~ -samefile ~/.zshrc
ls -la ~/.zshrc

Confirm only .zshrc shows up and the link count is back to 1.

Workaround (until CotEditor patches this)

Avoid opening/saving .zshrc (or other extensionless dotfiles) in CotEditor. Use one of these instead:

TextEdit β€” confirmed reliable, cleans up properly after saves.

alias editrc="open -a TextEdit ~/.zshrc"

nano β€” also reliable, faster for quick edits.

alias editrc="nano ~/.zshrc"

Update the editrc alias in .zshrc itself (edit via nano/TextEdit), then reload:

source ~/.zshrc

If a save fails again

  1. Run the find ~ -samefile ~/.zshrc check above.
  2. Remove any new stray .sb-* file.
  3. Retry the save with TextEdit or nano (not CotEditor).

Bug Report Reference

Filed with CotEditor (github.com/coteditor/CotEditor/issues) β€” includes: - macOS 26.5.2, CotEditor 7.0.5 - Reproduced independently on two separate Macs - Console sandbox deny line (mismatched .sh temp file extension) - Orphaned hard-link accumulation on failed saves - Cascading effect: orphan blocks subsequent saves by other apps too