{ "info": { "author": "Aaron Meurer", "author_email": "asmeurer@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: MacOS X", "Operating System :: MacOS :: MacOS X", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3" ], "description": "prefsync\n========\n\nA little tool to help synchronize Mac OS X plist files (used for preferences\nfor most Mac Apps) seamlessly, in a way that can be tracked by git.\n\n# Background\n\nQuite a few of us on GitHub upload our\n[dotfiles](http://en.wikipedia.org/wiki/Configuration_file)\n([here are mine](https://github.com/asmeurer/dotfiles)). It's a nice way to\nshare configuration, track it with git, and with symlinking, it makes for a\nnice semi-manual synchronization scheme.\n\nThis trick doesn't work so well with Mac OS X preferences. The issue is that\nas of Mac OS X 10.4, [plist files](http://en.wikipedia.org/wiki/Plist) are\nbinary by default, making them very difficult to track with git.\n\nA typical solution to this file is to symlink the plist files to Dropbox---and\nas far as I know that works. But you lose the ability to easily share your\nsettings, and perhaps most importantly, track them with git.\n\nThe good news is that it's actually possible to use binary plist files, and\nautomatically convert them back and forth to human-readable (and git\ntrackable) XML, using some tools that come with Mac OS X.\n\n# Usage\n\n usage: prefsync [-h] [-t THROTTLE_INTERVAL] PREFFILE DEST\n\nFor example\n\n prefsync ~/Library/Preferences/preferencefile.plist preferencefile.xml\n\nThe `-t` flag sets the throttle interval for syncing the file, in seconds. The\ndefault is 10 seconds.\n\n# Installing\n\nYou can install it with conda using\n\n conda install -c asmeurer prefsync\n\nOr using pip\n\n pip install prefsync\n\nOr from the git source\n\n python setup.py install\n\nOr you can just run it from the checkout, with\n\n python -m prefsync\n\nOnce you install it, use the command `prefsync`.\n\n# How it works\n\nIt's actually quite simple. The heavy work is done for us by the operating\nsystem and tools it provides. The main tools are\n[plutil](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/plutil.1.html),\nwhich allows to convert binary plist files to xml plist files and xml plist\nfiles back to binary, and [launchd](http://en.wikipedia.org/wiki/Launchd),\nwhich provides a facility to automatically run a script when a file changes.\n\nThere are some catches, though.\n\nFirst, if you just do this, it will run cyclically forever, because as soon as\nthe binary file is updated, it will write to the xml version, which will\nregister as a change, causing it to write the binary plist, and so on.\n\nWe get around this by writing a special extended attribute to each file when\nit is written, and ignoring files if they have that attribute (so that only\nchanges by other things will register). This will break if something somehow\npreserves these attributes. In my tests, they don't, but you can easily test\nif your program does by running\n\n xattr -w test:Test test ~/Library/Preferences/preferencefile.plist\n\nthen, make a change to the preferences, and see if the atttribute is still there\n\n xattr ~/Library/Preferences/preferencefile.plist\n\nSecond, in Mac OS X 10.9, preferences are cached, meaning that even if a\nprogram is closed and the plist file is written to, it will be overridden with\nthe original preferences when it is opened again if the cache was not\nflushed.\n\nGetting around this is easy: we just call\n\n defaults read com.reversedns.preference\n\n(where `com.reversedns.preference` is the reverse DNS for the preference file\nin question). This flushes the cache.\n\nFinally, it generally doesn't work to update the binary preference file while\na program is running. You may be able to just close and reopen the program,\nbut it may write to the preferences when you do that, overwriting the\nchanges.\n\nTherefore, it is *highly* recommended to track the XML changes in git, so that\nif they are overwritten they can be easily recovered. To force the changes to\nbe written to the binary, the easiest way is to close the program, make sure\nthe xml changes are the same (i.e., closing the program didn't cause the\npreferences to be written and synced over to the xml), and then touch the xml\nfile.\n\nNote that the synchronization in each direction may take up to 10 seconds by\ndefault to take place. You can change this by setting the `-t` flag when\nrunning `prefsync`.\n\n# Gotchas\n\nAccording to\n[this page](http://managingosx.wordpress.com/2006/05/10/launchd-gotcha/)\nlaunchd will stop watching a path if it ceases to exist. You can reset the\nprocess by logging out and logging back in, or by restarting. You can also\ntry using `launchctl`, though this may not work reliably.\n\n# TODO\n\nThere is currently no easy way to remove a sync. The best way is to open\nLingon and delete the syncs for the preferences you no longer want to sync. Be\nsure to delete both `binarytoxml` and `xmltobinary`. You will need to log out\nand log back in or restart for changes to take effect.\n\n# Acknowledgments\n\nThe Lingon program is invaluable when working with launchd (the older, free\nversion works just fine).\n\nStackOverflow and Mac OS X Hints helped me debug some of the strangeness\nwhen trying to get this to work.\n\n# License\n\nMIT (see the LICENSE file).", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/asmeurer/prefsync", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "prefsync", "package_url": "https://pypi.org/project/prefsync/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/prefsync/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/asmeurer/prefsync" }, "release_url": "https://pypi.org/project/prefsync/1.2/", "requires_dist": null, "requires_python": null, "summary": "A little tool to help synchronize Mac OS X plist files\n (used for preferences for most Mac Apps) seamlessly, in a way that can\n be tracked by git.", "version": "1.2" }, "last_serial": 1914082, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "8acc1dd3136e5f4babc0cb5ed9563a7a", "sha256": "5c416809b283efd8c0f4ecebddb5a1a5b3719006f3ee35e7a614da4dbcd6a769" }, "downloads": -1, "filename": "prefsync-1.0.tar.gz", "has_sig": false, "md5_digest": "8acc1dd3136e5f4babc0cb5ed9563a7a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5559, "upload_time": "2014-08-09T23:18:56", "url": "https://files.pythonhosted.org/packages/24/b2/60621e6e2ebfbc75fc98e4b88b5dba024c36a5425dbdcfe5484f1cdfcefd/prefsync-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "541e04e8ffedff46dae945377b5fe6ec", "sha256": "ae2ccd948e3ef2e4ce844bdbb5543f708514cb33b34daa121eb38c5b20ee11a6" }, "downloads": -1, "filename": "prefsync-1.1.tar.gz", "has_sig": false, "md5_digest": "541e04e8ffedff46dae945377b5fe6ec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5851, "upload_time": "2016-01-04T07:12:14", "url": "https://files.pythonhosted.org/packages/09/d1/54e68811439e02fa604391f51afbe1a880392076b2f405cb04d71acac6c1/prefsync-1.1.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "1a422a7c8d5a81b319592afab3ff4f52", "sha256": "66f0d3870b442e715de23b632e83f27f5971885b40bb3f6b211437138c554496" }, "downloads": -1, "filename": "prefsync-1.2.tar.gz", "has_sig": false, "md5_digest": "1a422a7c8d5a81b319592afab3ff4f52", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5920, "upload_time": "2016-01-20T21:52:26", "url": "https://files.pythonhosted.org/packages/db/d9/aa590b817477b15706e605d0bf0eff0575a7d717fba99bbd8d672e4fde53/prefsync-1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1a422a7c8d5a81b319592afab3ff4f52", "sha256": "66f0d3870b442e715de23b632e83f27f5971885b40bb3f6b211437138c554496" }, "downloads": -1, "filename": "prefsync-1.2.tar.gz", "has_sig": false, "md5_digest": "1a422a7c8d5a81b319592afab3ff4f52", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5920, "upload_time": "2016-01-20T21:52:26", "url": "https://files.pythonhosted.org/packages/db/d9/aa590b817477b15706e605d0bf0eff0575a7d717fba99bbd8d672e4fde53/prefsync-1.2.tar.gz" } ] }