macOS 配置文件备份 app dotfiles备份

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

mac下各种app安装之后可能自己配置了各种快捷键,或者自定义的配置,如果更换电脑的话

又需要重新配置【假设没有Time Machine

比如.vimrc比如.zshrc看似小,但是蛮重要的

推荐工具如下:

https://github.com/lra/mackup

Detailed install instructions for Mackup

There are 2 ways to run mackupInstall it with Homebrew (OSX only)Install it with PIP (OSX and GNU/Linux)

我这里直接走pip安装了

?  Downloads which pip/usr/local/bin/pip?  Downloads /usr/local/bin/pip3.9 install mackup大致过程省略  Stored in directory: /Users/lex/Library/Caches/pip/wheels/70/4a/46/1309fc853b8d395e60bafaf1b6df7845bdd82c95fd59dd8d2bSuccessfully built mackup docoptInstalling collected packages: docopt, mackupSuccessfully installed docopt-0.6.2 mackup-0.8.32

安装OK之后:直接查看帮助

/usr/local/bin/mackup listError: Unable to find your Dropbox install =(这里提示没有配置Dropbox继续,看来默认的备份配置走的Dropboxhttps://github.com/lra/mackup/blob/master/doc/README.md  ?  ~ cat ~/.mackup.cfgcat: /Users/lex/.mackup.cfg: No such file or directory?  ~ pwd/Users/lex?  ~ vi ~/.mackup.cfg继续,我想直接放到我的icloud下,继续?  ~ cat ~/.mackup.cfg[storage]engine = iclouddirectory = .config/mackup继续命令查看:?  ~ mackup listSupported applications: - 1password-4 - 2do - ack - adium - adobe-camera-raw现在开始备份:?  ~ mackup backupMackup needs a directory to store your configuration filesDo you want to create it now? </Users/lex/Library/Mobile Documents/com~apple~CloudDocs/.config/mackup> <Yes|No>YesBacking up .ansible ...Backing up Library/Preferences/com.apple.Music.plist ...Backing up Library/Preferences/com.apple.Music.eq.plist ...Backing up Library/Preferences/calibre ...Backing up Library/Application Support/Charles ...Backing up Library/Preferences/com.xk72.charles.config ...Backing up Library/ColorSync/Profiles ...Backing up .config/copyq ...Traceback (most recent call last):  File "/usr/local/bin/mackup", line 8, in <module>    sys.exit(main())  File "/usr/local/lib/python3.9/site-packages/mackup/main.py", line 93, in main    app.backup()  File "/usr/local/lib/python3.9/site-packages/mackup/application.py", line 117, in backup    utils.copy(home_filepath, mackup_filepath)  File "/usr/local/lib/python3.9/site-packages/mackup/utils.py", line 105, in copy    shutil.copytree(src, dst)  File "/usr/local/Cellar/python@3.9/3.9.0/Frameworks/Python.framework/Versions/3.9/lib/python3.9/shutil.py", line 554, in copytree    return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,  File "/usr/local/Cellar/python@3.9/3.9.0/Frameworks/Python.framework/Versions/3.9/lib/python3.9/shutil.py", line 510, in _copytree    raise Error(errors)shutil.Error: [('/Users/lex/.config/copyq/.copyq_s', '/Users/lex/Library/Mobile Documents/com~apple~CloudDocs/.config/mackup/.config/copyq/.copyq_s', "[Errno 102] Operation not supported on socket: '/Users/lex/.config/copyq/.copyq_s'")]简单来看我的copyq软件有点问题,那就暂时不备份他了,如果跳过这个,设置里面也有相关配置将其屏蔽掉。继续修改cat ~/.mackup.cfg[storage]engine = iclouddirectory = .config/mackup# Example, to not sync copyq:[applications_to_ignore]copyq我的大致过程如下:?  ~ mackup backupBacking up Library/Application Support/Dash/library.dash ...Backing up Library/Preferences/com.kapeli.dashdoc.plist ...Backing up .docker/config.json ...Backing up .gitconfig ...Backing up .config/htop/htoprc ...Backing up Library/Preferences/com.colliderli.iina.plist ...Backing up Library/Preferences/com.bjango.istatmenus.plist ...Backing up Library/Preferences/com.bjango.istatmenus.status.plist ...Backing up Library/Preferences/com.bjango.istatmenus6.extras.plist ...Backing up Library/Preferences/com.googlecode.iterm2.plist ...Backing up .config/karabiner ...Backing up .kube/config ...Backing up .mackup.cfg ...Backing up Library/Speech/Speakable Items ...Backing up Library/PDF Services ...Backing up Library/Scripts ...Backing up Library/Preferences/com.apple.symbolichotkeys.plist ...Backing up Library/Workflows ...Backing up Library/Preferences/com.crowdcafe.windowmagnet.plist ...Backing up .ssh/config ...Backing up .ssh/authorized_keys ...Backing up Library/Preferences/ru.keepcoder.Telegram.plist ...Backing up Library/Preferences/com.apple.Terminal.plist ...Backing up .vimrc ...Backing up Library/Application Support/Code/User/settings.json ...Backing up Library/Application Support/Code/User/snippets ...Backing up .wget-hsts ...Backing up .config/wireshark ...Backing up Library/Developer/Xcode/UserData/KeyBindings ...Backing up Library/Preferences/com.apple.dt.Xcode.plist ...Backing up .zshrc ...

然后到对应的备份目录查看下大致的配置:

?  mackup pwd/Users/lex/Library/Mobile Documents/com~apple~CloudDocs/.config/mackup?  mackup ls -altotal 36drwxr-xr-x 13 lex staff   416 Jan 20 11:27 .drwxr-xr-x  3 lex staff    96 Jan 20 11:22 ..drwx------  4 lex staff   128 Oct 27 10:17 .ansibledrwxr-xr-x  6 lex staff   192 Jan 20 11:27 .configdrwxr-xr-x  3 lex staff    96 Jan 20 11:27 .docker-rw-------  1 lex staff    48 Jan 20 11:27 .gitconfigdrwxr-xr-x  3 lex staff    96 Jan 20 11:27 .kube-rw-------  1 lex staff   114 Jan 20 11:27 .mackup.cfgdrwxr-xr-x  4 lex staff   128 Jan 20 11:27 .ssh-rw-------  1 lex staff 10310 Jan 20 11:27 .vimrc-rw-------  1 lex staff   253 Jan 20 11:27 .wget-hsts-rw-------  1 lex staff  9684 Jan 20 11:27 .zshrcdrwxr-xr-x 10 lex staff   320 Jan 20 11:27 Library?  mackup tree.└── Library    ├── Application Support       ├── Charles          ├── backup             └── charles-4.5.6-backup.config          ├── ca             ├── charles-proxy-ssl-proxying-certificate.cer             ├── charles-proxy-ssl-proxying-certificate.pem             └── keystore          ├── passwords.keystore          └── profiles              └── default.cfg.xml       ├── Code          └── User              ├── settings.json              └── snippets       └── Dash           └── library.dash    ├── ColorSync       └── Profiles    ├── Developer       └── Xcode           └── UserData               └── KeyBindings                   └── Default.idekeybindings    ├── PDF Services       └── ?206 PDF ?235?230?210? ?215?象?224记    ├── Preferences       ├── calibre          ├── caches          ├── conversion             ├── debug.py             ├── epub_output.py             ├── heuristics.py             ├── look_and_feel.py             ├── metadata.py             ├── mobi_output.py             ├── page_setup.py             ├── pdf_output.py             ├── search_and_replace.py             ├── structure_detection.py             └── toc.py          ├── customize.py.json          ├── dynamic.pickle.json          ├── fonts             └── scanner_cache.json          ├── global.py.json          ├── gui.json          ├── gui.py.json          ├── plugins          ├── store             ├── plugin_cache.json             └── search.json          ├── viewer             └── annots                 ├── 32e3e8a97e030b016bb5d4f5eb5309d7cd65bd29a226f484487caf124852f0c5.json                 └── 72801ae89b9d6e80e06589f1e2597e088063692301b52548528f5d0b2c47403e.json          └── viewer-webengine.json       ├── com.apple.Music.eq.plist       ├── com.apple.Music.plist       ├── com.apple.Terminal.plist       ├── com.apple.dt.Xcode.plist       ├── com.apple.symbolichotkeys.plist       ├── com.bjango.istatmenus.plist       ├── com.bjango.istatmenus.status.plist       ├── com.bjango.istatmenus6.extras.plist       ├── com.colliderli.iina.plist       ├── com.crowdcafe.windowmagnet.plist       ├── com.googlecode.iterm2.plist       ├── com.kapeli.dashdoc.plist       ├── com.xk72.charles.config       └── ru.keepcoder.Telegram.plist    ├── Scripts    ├── Speech       └── Speakable Items    └── Workflows        └── Applications            ├── Calendar            ├── Folder Actions            └── Image Capture

如果第二次备份可能有要覆盖的操作,所以参数也有

/usr/local/bin/mackup-f --force    Force every question asked to be answered with "Yes"./usr/local/bin/mackup -f backup

然后可以弄一个crontab定时备份下:

0 11 * * * /usr/local/bin/mackup -f backup >/dev/null 2>&1

多一种方式备份,总是好的 哈。

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2021年1月26日
下一篇 2021年1月26日

相关推荐