Closed owpac closed 6 months ago
$ chezmoi status MM Library/Preferences/com.googlecode.iterm2.plist
The M
in the first column indicates that another program (probably iTerm2 itself) has modified Library/Preferences/com.googlecode.iterm2.plist
since chezmoi last wrote it. Therefore, if chezmoi were to overwrite it, then you would lose some local changes.
Unfortunately iTerm2 is one of those naughty programs that modifies its own configuration files. You have a few options:
modify_
script to just modify the parts of com.googlecode.iterm2.plist
that you care about.defaults
command.Thanks a lot for your reply!
You're right, the issue is on ITerm2 side.
I tried your options:
*.plist
files are binary files, so I can't really know which part to modify with chezmoi.Library/Preferences
anymore). That's why I wanted to use the copy mechanism in the first place.I can't think of another alternative to bypass this new MacOS 14 limitation & my need to save some app's configuration. Maybe I will just chezmoi apply --force
and if I need to persist some new settings, I will need to chezmoi re-add
🤔
Anyway, thanks for everything @twpayne 🙏
- modify_ script is not a suitable solution because the
*.plist
files are binary files, so I can't really know which part to modify with chezmoi.
I think something like the following should work in ~/.local/share/chezmoi/Library/Preferences/modify_com.googlecode.iterm2.plist
(warning: untested):
#!/bin/bash
# create a temporary file
tmpfile=$(mktemp)
# ensure that the temporary file is removed on exit
trap "rm -f $(tmpfile)" EXIT
# write the .plist to the temporary file
cat > "$(tmpfile)"
# replace .plist values in the temporary file
plutil -replace MyBoolValue -bool false "$(tmpfile)"
# write the temporary file to stdout
cat "$(tmpfile)"
- macOS's defaults command can't help me save my ITerm2 configuration, unfortunately.
I think you can use a script that uses plutil
to replace values in Library/Preferences/com.googlecode.iterm2.plist
(warning: untested).
Interesting! It's gonna need a bit of digging, but I'm going to try that out! Thanks a lot for your ideas!
Describe the bug
When saving *.plist files with
chezmoi add
and then checking the status withchezmoi status
, chezmoi will say the files aren't the same (without any differences).To reproduce
Step 1)
Step 2)
Expected behavior
In the step 2 we should have no differences returned by
chezmoi status
norchezmoi diff
Output of command with the
--verbose
flagOutput of
chezmoi doctor
Additional context
Note that I tried to
chezmoi re-add
,chezmoi apply
and then overwrite, butchezmoi status
keep saying that there are differences between the files.Thanks a lot for all your work on chezmoi.