lra / mackup

Keep your application settings in sync (OS X/Linux)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

App settings will not persist on macOS 14

scottrobertson opened this issue · comments

I have been trying to work out why my app settings are all resetting, and not persisting in macOS 14. This has been happening for apps such as Raycast, iTerm, Rectangle, Bartender etc. I just tried running mackup uninstall and everything is fixed. And then when i run mackup backup again, none of my settings will persist or save again. Any ideas?

Which files storage method are you using? Can you share your ~/.mackup.cfg with us?

[storage]
engine = icloud

[applications_to_ignore]
oh-my-zsh
espanso

iCloud

I've seen other mackup users using iCloud have has similar issues. Could you try turning off the feature to optimize mac storage and see if that helps? It will be under the iCloud settings.

Screenshot 2023-06-07 at 4 36 32 PM

My thinking is iCloud is removing these config files from your hard drive to save storage.

Hey. Just tried that, and it did not help, sadly.

I also did the following:

  • mackup uninstall
  • Open an app, all settings are fine
  • Rename/remove ~/Library/Mobile Documents/com~apple~CloudDocs/Mackup
  • Run mackup backup
  • Reopen the same app, and it has reset all settings
  • mackup uninstall
  • Reopen the app, and all the settings are back

Can you confirm the symbolic links that are generated are valid? The Rename/remove step you mentioned could be causing the symbolic links to break.

@lra any ideas?

To be clear, I had already run mackup uninstall before the rename/remove. I ran that earlier today to get things working. I did the rename/remove just to basically do a "fresh start" to rule out any old files causing issues etc.

Hey. Just an update here. I just tried this again using

[storage]
engine = file_system
path = Mackup/

And i get the same result. I run mackup backup, open iTerm2 for example, and all settings have wiped, run mackup uninstall and open it again, and settings are back. So i don't think iCloud is the issue.

I have same issue

Same issue. Started happening when I updated to Dropbox beta, and then tried moving to iCloud. Now it's a mess. Not sure what's wrong, unable to predict a pattern here but with latest macOS this happens:

  • All of a sudden some apps loose their config (have to reconfigure)
  • Some apps like iTerm2 or Terminal don't keep their configs no matter what I do (uninstall/install fresh doesn't help)

+1 on this issue. I was going to say I wonder if this is related to the Apple update that basically made it harder for Cloud apps to work on mac. It also meant you had to change the location of your Dropbox drive.

https://help.dropbox.com/installs/macos-support-for-expected-changes

+1 on this issue. I was going to say I wonder if this is related to the Apple update that basically made it harder for Cloud apps to work on mac. It also meant you had to change the location of your Dropbox drive.

https://help.dropbox.com/installs/macos-support-for-expected-changes

I don’t think it’s that, no. It even stops working if I just use the file system storage method.

Then I would say it's a recent Apple update. For me this started happening in the last week, which is when I updated to Ventura 13.4.1 (might've also been when I updated to 13.4).

It's possible that there's an unknown bug with the latest update or a "security improvement" that's messing with symlinks 🤔

I've done mackup uninstall for now which has fixed everything but it would be interesting if mackup has any logs stored somewhere? To see exactly what was erroring out. Perhaps a permissions issue that was going undetected? Who knows at this point.

Just lost a couple days on this exact issue because it took me a while to figure why a lot of my settings weren't saving and that mackup was the culprit. Hope this gets solved quickly.

cc me

Any updates on this one? I am having the same issues and it's maddening. I will uninstall for now, but hope it gets fixed soon because I really love Mackup.

MacOS: 14.0 Public Beta (23A5286i)
Mackup: 0.8.37

[storage]
engine = file_system
path = SynologyDrive/Backups

[applications_to_ignore]
illustrator
mackup
zsh
path-finder
streamdeck

If for some reason this issue is due to symlinks and effectively impossible to fix going forward, it might be a good idea to offer an alternate mode of backup by copying over files instead of symlinking them, so that at least the tool doesn't become fully obsolete. I wouldn't mind doing a manual export/import every once in a while as a compromise instead of ditching Mackup altogether.

I'm quite frustrated with losing all the settings again and again. To a point where I'm planning on rewriting this project one way or the other. It's been mentally taxing. 😮‍💨

I understand life gets in a way and this free software. Appreciate all the hardwork.

If for some reason this issue is due to symlinks and effectively impossible to fix going forward, it might be a good idea to offer an alternate mode of backup by copying over files instead of symlinking them, so that at least the tool doesn't become fully obsolete. I wouldn't mind doing a manual export/import every once in a while as a compromise instead of ditching Mackup altogether.

Exactly. Honestly, I wish this was a feature today. I don’t really need the symlinking anyway. I just want the peace of mind that when I run mackup backup, my settings are copied somewhere that is versioned and backed up.

commented

I've seen other mackup users using iCloud have has similar issues. Could you try turning off the feature to optimize mac storage and see if that helps? It will be under the iCloud settings.

Screenshot 2023-06-07 at 4 36 32 PM My thinking is iCloud is removing these config files from your hard drive to save storage.

same with the new Dropbox in CloudStorage.

I've seen other mackup users using iCloud have has similar issues. Could you try turning off the feature to optimize mac storage and see if that helps? It will be under the iCloud settings.
Screenshot 2023-06-07 at 4 36 32 PM
My thinking is iCloud is removing these config files from your hard drive to save storage.

same with the new Dropbox in CloudStorage.

I don't use either of these. I use SynologyDrive and have it set to sync everything. I don't think it has anything to do with the storage engine. I've had to temporarily remove Mackup to get things working, but like I said, I'm hoping they add a way to "copy" your prefs to another location instead of doing the whole symlink thing. That would be fine and preferable, for me.

commented

for me things started failing with Dropbox when they moved to the new CloudStorage shit. (see #1891.) now you can't be certain that Dropbox starts at a proper time. i think the whole symlink thing should be gone yeah. maybe there's something also related to macOS 14 itself, where now it seems we need Apple's approval to read and write our own UserDefaults 🤣️

I've been debugging same issue for past hour, and finally understood that it's due to mackup.

I'm running Sonoma beta.

Here's how it look:

rejecting write of key(s) mainWindowPositionCache in { com.raycast.macos, sergey.petrov, kCFPreferencesAnyHost, /Users/sergey.petrov/Library/Preferences/com.raycast.macos.plist, managed: 0 } from process 7061 (Raycast) because Path not accessible

Same problem here with Sonoma RC. Mackup is broken :(

I am experiencing a similar issue, but it is quite strange. My Intel iMac is functioning properly, while my M2 MacBook has stopped working.

Can confirm, having major issues in Sonoma, both for app settings but also system plists; (com.apple.* for example). Discovered it when settings for Tower (the Git-client) and system-level keyboard shortcuts (Library/Preferences/com.apple.symbolichotkeys.plist) didn't persist between reboots.

mackup.cfg:

[storage]
engine = icloud

[applications_to_ignore]
zsh

Same issue, settings are not persisted.

Only 'fix' for now is mackup uninstall

my backup workflow is now mackup backup --force && mackup uninstall

Just as additional information, defaults also doesn't work if the preferences file is a symlink but works with a plain file. So definitely symlinks are the problem.

Same here as soon as I installed Sonoma, damn… I have a lot of other "non-standard" setup with symlinks too, I really hope they're not all broken…

Edit… They still seem to work thankfully.

Same problem when upgraded to Sonoma, really want a copy option or use FSEvents API to auto copy config files

Apps use plist are broken, eg iTerm2, Apple Music, others like vim are fine

If anyone with MacOS 13.6 or 12.7 could confirm then it could be it.

My temp workflow:
Saving configs (when leaving a machine): mackup backup && mackup uninstall
Loading configs (on new machine): mackup restore && mackup uninstall
Mackup sync feature is bypassed but still better than nothing as mackup still locates/copies files.

Same for me, except I skip prompts:

$ mackup backup --force && mackup uninstall --force
$ mackup restore --force && mackup uninstall --force

Going to just chime in for subbing that I'm also seeing this issue. Started when my Zoom global keyboard shortcut somehow kept resetting after a reboot. Turns out that is synced with mackup, and found the same symlink issue. Will take this workaround for now to backup/restore as mentioned. Hoping someone can figure out what Apple did.

I'm on Ventura 13.6, 2020 m1, and just tried to reinstall mackup after I already brew uninstall mackup (as that didn't remove the symlinks) and eventually tracking the issue that I had with iina not saving prefs to here (ref'd above).

EDIT: seemed to get to uninstall after much finnaggling (still shows a dropbox not installed error when dropbox was neither confgured nor listed in mackup.cfg, go figure), still to test if prefs are saving in various apps properly.
This is a helluva mess!

So, I brew install mackup again (along with crap-ton of dependencies) so I could try mackup uninstall, which I hoped would remove symlinks (which I didn't even realise Mackup was doing, should have RTFM) but instead got:

mackup uninstall
/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.12/site-packages/docopt.py:165: SyntaxWarning: invalid escape sequence '\S'
  name = re.findall('(<\S*?>)', source)[0]
/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.12/site-packages/docopt.py:166: SyntaxWarning: invalid escape sequence '\['
  value = re.findall('\[default: (.*)\]', source, flags=re.I)
/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.12/site-packages/docopt.py:207: SyntaxWarning: invalid escape sequence '\['
  matched = re.findall('\[default: (.*)\]', description, flags=re.I)
/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.12/site-packages/docopt.py:456: SyntaxWarning: invalid escape sequence '\S'
  split = re.split('\n *(<\S+?>|-\S+?)', doc)[1:]
Traceback (most recent call last):
  File "/opt/homebrew/bin/mackup", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.12/site-packages/mackup/main.py", line 66, in main
    mckp = Mackup()
           ^^^^^^^^
  File "/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.12/site-packages/mackup/mackup.py", line 24, in __init__
    self._config = config.Config()
                   ^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.12/site-packages/mackup/config.py", line 46, in __init__
    self._parser = self._setup_parser(filename)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.12/site-packages/mackup/config.py", line 150, in _setup_parser
    parser = configparser.SafeConfigParser(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?

Doesn't bode well.

Also tried:

mackup backup --force && mackup uninstall --force
/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.12/site-packages/docopt.py:165: SyntaxWarning: invalid escape sequence '\S'
  name = re.findall('(<\S*?>)', source)[0]
/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.12/site-packages/docopt.py:166: SyntaxWarning: invalid escape sequence '\['
  value = re.findall('\[default: (.*)\]', source, flags=re.I)
/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.12/site-packages/docopt.py:207: SyntaxWarning: invalid escape sequence '\['
  matched = re.findall('\[default: (.*)\]', description, flags=re.I)
/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.12/site-packages/docopt.py:456: SyntaxWarning: invalid escape sequence '\S'
  split = re.split('\n *(<\S+?>|-\S+?)', doc)[1:]
Traceback (most recent call last):
  File "/opt/homebrew/bin/mackup", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.12/site-packages/mackup/main.py", line 66, in main
    mckp = Mackup()
           ^^^^^^^^
  File "/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.12/site-packages/mackup/mackup.py", line 24, in __init__
    self._config = config.Config()
                   ^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.12/site-packages/mackup/config.py", line 46, in __init__
    self._parser = self._setup_parser(filename)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.12/site-packages/mackup/config.py", line 150, in _setup_parser
    parser = configparser.SafeConfigParser(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?

I'm on Ventura 13.6, 2020 m1, and just tried to reinstall mackup after I already brew uninstall mackup (as that didn't remove the symlinks) and eventually tracking the issue that I had with iina not saving prefs to here (ref'd above).

EDIT: seemed to get to uninstall after much finnaggling (still shows a dropbox not installed error when dropbox was neither confgured nor listed in mackup.cfg, go figure), still to test if prefs are saving in various apps properly. This is a helluva mess!

So, I brew install mackup again (along with crap-ton of dependencies) so I could try mackup uninstall, which I hoped would remove symlinks (which I didn't even realise Mackup was doing, should have RTFM) but instead got:

#1948 - this find helped me fix this issue. Seems widespread. I made the change myself manually in config.py and appsdb.py per the linked PR, you can see what needs to change.
This will help anyone having similar error of:
AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?

Does the latest version fix this? It seems to fix other issues, but iTerm specifically still has the same error

Doesn't fix it for me. It seems like new macOS doesn't follow symbolic links in Preferences. I think that the only fix is to replace symbolic links with the files.

I think this is still able to set symbolic links in Sonoma https://github.com/nickzman/symboliclinker/blob/master/SymbolicLinker.m

I thought it was (apart from iTerm) and then I restarted and everything reset, so uninstalled again for now :(

I think the only thing we can do is to change the mackup behaviour from symlinking to copying files to the backup dir. @lra what do you think?

I think the only thing we can do is to change the mackup behaviour from symlinking to copying files to the backup dir. @lra what do you think?

Personally, I’d love this option anyway. I don’t necessarily need symlinks. I just want to copy all my prefs to another folder that’s backed up and revisioned.

commented

I think the only thing we can do is to change the mackup behaviour from symlinking to copying files to the backup dir. @lra what do you think?

I think this is the way. Only concern is this could be an unexpected change for a lot of users who don't read the repo and for users who have symlinks currently in place.

I think the only thing we can do is to change the mackup behaviour from symlinking to copying files to the backup dir. @lra what do you think?

I think this is the way. Only concern is this could be an unexpected change for a lot of users who don't read the repo and for users who have symlinks currently in place.

We can either change a major version number, to indicate a breaking change or fork it to the new repo that will have only copying feature. Migrating from symlink to copy will be easy as mackup restore && mackup uninstall.

I'm wonder what @lra thinks as he is the author ;)

I'm unsure if this is related, but I'm also finding that now even though I have uninstalled mackup completely, certain applications keep losing their preferences on quit, I am not even sure if they write a preferences file. I can see console is full of prefsd errors and I am not really sure what to do about this one and it's getting quite annoying 😅

@ChrisChinchilla I'm experiencing the same thing.

Has anyone found a fix for that? Using mackup uninstall removes some symlinks but many applications now cannot save their preferences.

iTerm
BetterTouchTool
F.lux
VS Code

Yeah, it seems latest versions of mac don't like symlinking .plist files.

EDIT: For anyone who finds this -- here's what worked for me to recover some stuff:

  • mackup uninstall didn't remove all the symlinks that I had. Some still stuck around.
  • The above applications have .plist files stored in directories like ~/Library/Preferences/com.microsoft.vscode or similar folders. So in terminal you can find all your apps like this by doing cd ~/Library/Preferences && ls -la -- you will see the symlinks. You might check your ~/Library/Application Support/ folder too (escape the space in the terminal).
  • I replaced those symlinks with the actual folders and those apps will now persist settings correctly again.
  • Replacing all symlinks in both those folders with the original config files (still stored in Dropbox thankfully) fixed it for me

Will be looking to another symlink-free backup solution. 🥵

As a temporary measure, I replaced all plist soft links with hard links:

for file in $MACKUP_DIR/**/*.plist; do
  ln -f "$file" "~/$file"
done
  • They are still backed up
  • mackup backup will consider these new, and ask to soft-link again - say "No"

Update: It seems the hard links get overwritten with the actual files, so this method is not reliable.

Note that I also maintain a Git repository with a separate remote in the Mackup folder, so I can revert if everything goes haywire.

I don't think that there is any other solution to this problem rather than invent a backup mechanism with a different behaviour than symlinking. For MVP it could be a one-way copy. There is even PR for that #1947
It would be good if @lra speaks up and help us fix this issue.

Yeah, I ended up just manually replacing everything.

Thanks for all the feedback, I understand that there is a big problem, but before taking any decision, I'd like to understand what is the actual underlying problem? Is it related to linked plist files? Is it soft links? Would hard links solve the issue?

Can anyone reproduce the issue?

macos 14 is still not available as a github runner for tests (https://docs.github.com/fr/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources) but I'd like someone to pinpoint the issue so I can reproduce it.

Regarding the copy feature, I'll do it, not sure how yet, I made a poll if you want to discuss it: #1969

Let's keep this issue about the link lost problem.

Thanks.

Thanks @lra for answering.
To reproduce this issue, you can do the following:

  1. Install iTerm2
  2. Run it
  3. Set Settings -> Appearance -> General -> Theme to Minimal. You should be able to see the difference with the Regular theme.
    • This step is needed to see the problem
  4. Close it with Cmd + Q
  5. Backup it up using mackup backup
    I've added simple code in appsdb.py:34 to narrow down mackup, to only that app:
if config.read(config_file):
  if not config_file.endswith("iterm2.cfg"):
    continue
  1. Run iTerm2 again.
  2. You should see something similar to this image and your theme should be set to Regular.
image

That shows, that theme was not persisted on disk. That have to have something with symlinking plist files, because when I make a hard link, it persists all settings.

I'm not sure if this is new behavior but it seems like using ln -s (at least sometimes) doesn't create a symlink but rather an alias.

Has anyone tried to use mackup on a fresh install of macos instead an upgrade?

Here is a little background context on the different APFS links for those trying to look into this, I didn't know there was a difference between alias and a soft link.

aws has mac instances available for testing https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-mac-instances.html

I lost my sanity a little bit trying to figure out what was going on here between Sonoma versions - eventually gave up.

For me things were working OK for almost all plists on 14.0 and 14.1 except losing Keyboard shortcuts from System Settings, but on 14.2 everything then seemed broken, extending to iTerm2, Zoom, Stats, dock preferences and other things resetting to defaults and then not retaining values.

Quite difficult to figure out what was going on, but moved to the workflow suggested in #1924 (comment)

I never did manage to get Zoom to recognise my old settings though, started from scratch :-)

If anyone with MacOS 13.6 or 12.7 could confirm then it could be it.

I just wanted to chime in here that I have a home-grown solution that is not mackup, and previously it had worked for years with no issues. It's just this:

# Install all the configured preferences for our various apps
ln -sfn ${DOTFILES_LOCATION}/prefs/*.plist "${HOME}/Library/Preferences"
ln -sfn ${DOTFILES_LOCATION}/prefs/.GlobalPreferences.plist "${HOME}/Library/Preferences"

And today I've been trying to get it to work on a brand new MacOS Sonoma instance, and it did not work at all. Trying to run defaults read NSGlobalDomain returns:

Domain Apple Global Domain does not exist

But I can see it right there in the file system. So I double-checked on my other mac running Venture 13.3.1 and had no issues running defaults read NSGlobalDomain and it is also the exact same symlink I see on the mac that's not working. After reading everything here, I figured I'd try just copying the files over instead of sym-linking and sure enough, it just works.

As a final act of desperation I read the actual sym-linked file on the Sonoma Mac and its contents match the contents of the Venture mac 1:1—it just doesn't read the file at all. This seems to confirm my suspicion (along with a few others) that Sonoma will not allow sym-linking certain preference files anymore.

Big bummer, but hopefully this anecdote can help mackup find a solution.

Same problem after update to Sonoma. I currently found two apps are not working. KarabinerElements and Clash for Windows. They seem can't access the files which are symbolic links in iCloud. KarabinerElements said [2024-01-05 15:55:01.092] [error] [grabber] failed to open /Users/xxx/.config/karabiner/karabiner.json and Clash for Windows said .config/clash/Country.mmdb: operation not permitted in their logs. I also find that other apps which are working well showed a dialog to request the permission to access the file inside iCloud as shown below (I'm not sure they are totally working well since I just update to Sonoma for several hours):
image
It seems KarabinerElements and Clash for windows didn't show the dialog (I'm not 100% sure). If this is the root cause of these problems, is there a way to grant the permission to access files inside iCloud manually?
BTW, how does the app to show that dialog programatically when it need to access files inside iCloud? I'm not a mac os programmer but I guess there should be a way.

Granting permissions doesn't change anything. What breaks mackup on Sonoma are the symlinks.

Yeah - I believe the behavior possibly varies between applications and system elements based on the various versions of MacOS APIs/SDKs they use to load preferences/settings etc, and whether it uses the logic that is now blocking following symlinks when reading from a given path (likely for security reasons).

Is the takeaway that Mackup is, at present, hopelessly broken on 14.* with no fix in sight?

I guess so, unless it works for you to use an approach like #1924 (comment)

I am still using Mackup with this approach, which is OK for me because I wasn't relying on using Mackup to have a constantly updated backup of my settings into cloud storage, and was only saving/updstint a backup periodically anyway.

So I guess it depends on your needs/workflow.

@m0rg5 there is a fix in sight #1969 ;)

Does anyone have an understanding of why this is happening?

IIUC from the discussion, if a config file is a symlink, then the config file can't be read correctly — is that correct? Which would be surprising, given that symlinks should be transparent to most file reads

I think this could be the root cause #1924 (comment)