{"id":47525375,"url":"https://github.com/sindresorhus/DSStore","last_synced_at":"2026-04-11T10:01:08.522Z","repository":{"id":340575343,"uuid":"1166652904","full_name":"sindresorhus/DSStore","owner":"sindresorhus","description":"Parse and write macOS .DS_Store files from Swift","archived":false,"fork":false,"pushed_at":"2026-02-25T15:01:06.000Z","size":63,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-25T16:58:21.099Z","etag":null,"topics":["macos","parser","swift","swift-package","swift-package-manager"],"latest_commit_sha":null,"homepage":"https://swiftpackageindex.com/sindresorhus/DSStore/documentation/dsstore/dsstore","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sindresorhus.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","buy_me_a_coffee":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2026-02-25T13:08:27.000Z","updated_at":"2026-02-25T16:47:00.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sindresorhus/DSStore","commit_stats":null,"previous_names":["sindresorhus/dsstore"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sindresorhus/DSStore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2FDSStore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2FDSStore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2FDSStore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2FDSStore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/DSStore/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2FDSStore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31676210,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T08:18:19.405Z","status":"ssl_error","status_checked_at":"2026-04-11T08:17:08.892Z","response_time":54,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["macos","parser","swift","swift-package","swift-package-manager"],"created_at":"2026-03-27T19:00:32.570Z","updated_at":"2026-04-11T10:01:08.516Z","avatar_url":"https://github.com/sindresorhus.png","language":"Swift","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://buymeacoffee.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["Swift"],"sub_categories":[],"readme":"# DSStore\n\n\u003e Parse and write macOS [`.DS_Store`](https://en.wikipedia.org/wiki/.DS_Store) files\n\nA Swift library for reading, modifying, and creating `.DS_Store` files — the hidden files macOS uses to store Finder metadata like icon positions, view settings, and folder backgrounds.\n\nZero dependencies. Fully documented. Works great for building DMG installers with custom layouts.\n\n## Highlights\n\n- **Read \u0026 Write:** Parse existing files or create new ones from scratch.\n- **Strongly typed:** Type-safe records with `DSStore.Record` and `DSStore.Value`.\n- **Zero dependencies:** Pure Swift with no external dependencies.\n- **Well documented:** Comprehensive API documentation and code comments.\n- **Sendable:** Thread-safe types ready for Swift concurrency.\n\n## Install\n\nAdd the following to `Package.swift`:\n\n```swift\n.package(url: \"https://github.com/sindresorhus/DSStore\", from: \"0.1.0\")\n```\n\n[Or add the package in Xcode.](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app)\n\n## Usage\n\n### Reading a `.DS_Store` file\n\n```swift\nimport DSStore\n\nlet store = try DSStore.read(from: url)\n\n// Get all filenames referenced in the store\nprint(store.filenames)\n\n// Get all records for a specific file\nlet records = store.records(for: \"README.md\")\n\n// Get a specific record\nif let position = store.iconPosition(for: \"Application.app\") {\n\tprint(\"Icon at: \\(position.x), \\(position.y)\")\n}\n```\n\n### Creating a `.DS_Store` file\n\nPerfect for DMG installers with custom icon layouts:\n\n```swift\nimport DSStore\n\nvar store = DSStore()\n\n// Set icon positions\ntry store.setIconPosition(for: \"Application.app\", x: 140, y: 180)\ntry store.setIconPosition(for: \"Applications\", x: 480, y: 180)\n\n// Configure the Finder window\ntry store.setWindowBounds(top: 100, left: 100, bottom: 400, right: 620)\nstore.setViewStyle(.iconView)\n\n// Set a background color (RGB values 0-65535)\nstore.setBackground(.color(red: 65535, green: 65535, blue: 65535))\n\n// Write to disk\ntry store.write(to: url)\n```\n\n### Working with records directly\n\n```swift\nimport DSStore\n\nvar store = DSStore()\n\n// Add a Spotlight comment\nstore.add(DSStore.Record(\n\tfilename: \"Important.txt\",\n\ttype: .spotlightComment,\n\tvalue: .string(\"Don't delete this file!\")\n))\n\n// Add a custom blob record\nstore.add(DSStore.Record(\n\tfilename: \".\",\n\ttype: .custom(.literal(\"icvp\")),\n\tvalue: .data(plistData)\n))\n\n// Remove records\nstore.removeRecords(for: \"OldFile.txt\")\n```\n\n## API\n\n[See the API docs.](https://swiftpackageindex.com/sindresorhus/DSStore/documentation/dsstore/dsstore)\n\n## FAQ\n\n#### What is a `.DS_Store` file?\n\n`.DS_Store` (Desktop Services Store) is a hidden file created by macOS Finder in every folder it opens. It stores custom attributes like icon positions, view settings, and folder backgrounds.\n\n#### Why would I need to parse or create these files?\n\nThe most common use case is creating DMG installers with custom layouts — positioning the app icon and Applications folder alias in specific locations with a nice background image.\n\n#### Is the file format documented by Apple?\n\nNo, it's a proprietary format. This library is based on reverse-engineering work by Mark Mentovai, Wim Lewis, and others.\n\n#### Does this work on Linux?\n\nThe parsing and writing work anywhere Swift runs, but `.DS_Store` files are only used by macOS Finder.\n\n#### Can I use this to clean up `.DS_Store` files?\n\nYes! You can read a file, inspect its contents, remove entries, and write it back. Or just delete the file entirely — Finder will recreate it.\n\n#### Why did you make this?\n\nI just wanted to work around an [old macOS bug](https://x.com/sindresorhus/status/2026670099781005485).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2FDSStore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2FDSStore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2FDSStore/lists"}