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 ~/.zshrcA healthy file returns only .zshrc itself. If there are
extra results like .zshrc.sb-XXXXXXXX-XXXXXX, those are
orphaned sandbox temp files.
2. Confirm via link count
ls -la ~/.zshrcLook 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 ~/.zshrcConfirm 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 ~/.zshrcIf a save fails again
- Run the
find ~ -samefile ~/.zshrccheck above. - Remove any new stray
.sb-*file. - 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