{"id":13998231,"url":"https://github.com/loteoo/ks","last_synced_at":"2025-09-26T02:31:34.804Z","repository":{"id":186610527,"uuid":"675354675","full_name":"loteoo/ks","owner":"loteoo","description":"Command-line secrets manager powered by macOS keychains","archived":false,"fork":false,"pushed_at":"2024-07-16T00:51:51.000Z","size":22,"stargazers_count":65,"open_issues_count":2,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-09T19:44:02.249Z","etag":null,"topics":["bash","cli","command-line","macos","secrets-manager"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/loteoo.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}},"created_at":"2023-08-06T16:33:39.000Z","updated_at":"2024-12-21T11:18:49.000Z","dependencies_parsed_at":"2024-07-13T16:41:20.357Z","dependency_job_id":"4f5c772f-ee83-4842-aa2b-b5b3bb88840f","html_url":"https://github.com/loteoo/ks","commit_stats":null,"previous_names":["loteoo/ks"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loteoo%2Fks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loteoo%2Fks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loteoo%2Fks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loteoo%2Fks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loteoo","download_url":"https://codeload.github.com/loteoo/ks/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234286153,"owners_count":18808432,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["bash","cli","command-line","macos","secrets-manager"],"created_at":"2024-08-09T19:01:29.493Z","updated_at":"2025-09-26T02:31:29.531Z","avatar_url":"https://github.com/loteoo.png","language":"Shell","readme":"\u003ca href=\"https://millisecond.studio/\"\u003e\n  \u003cimg src=\"https://cdn.thumbsmith.com/v1/u/loteoo/millisecond-github-banner.png?title=ks+-+Keychain+Secrets+manager\u0026description=Command-line+secrets+manager+powered+by+macOS+keychains\" alt=\"ks banner\" /\u003e\n\u003c/a\u003e\n\n---\n\nCLI secrets manager that uses the native Keychain tools already available on macOS systems.\n\nIt's a tiny, straightforward CLI that let's you securely store and retrieve encrypted secrets without any additional third parties involved.\n\nIt's built as a small wrapper around the native `security` command, so it's fast, secure, works offline and is fully interoperable with macOS keychains, which give you:\n\n- A nice, built-in UI to manage your secrets ([Keychain Access](https://support.apple.com/en-ca/guide/keychain-access/kyca1083/mac) app).\n- Backup \u0026 syncing with iCloud, Google Drive, NextCloud, etc. [See iCloud example](#icloud-sync)\n- Integration with some browsers and other keychain-compatible software.\n\nhttps://github.com/loteoo/ks/assets/14101189/fec05de0-a5a7-47aa-9366-10ad20203eb8\n\n## Installation\n\n#### Install script\n\nUse the install script for an easy, interactive installation by running this command:\n\n```sh\nbash -c \"$(curl -fsSL https://raw.githubusercontent.com/loteoo/ks/main/install)\"\n```\n\n#### Homebrew\n\nYou can also install ks using homebrew:\n\n```sh\nbrew tap loteoo/formulas\nbrew install ks\n```\n\n\u003cdetails\u003e\u003csummary\u003eManual installation (click to open)\u003c/summary\u003e\n\n1. Download the script file from github.\n2. Place it into an executable directory that's in your $PATH. For instance, `~/.local/bin/ks`\n3. Make sure the file is executable. `chmod +x ~/path/to/ks`\n4. Run `ks init` to create a first keychain.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eContributor installation (click to open)\u003c/summary\u003e\n\nDelete any other instance of the `ks` script on your machine.\n\nClone this repo somewhere on your machine, then create a symlink in a bin folder to the script:\n\n```sh\n#         This directory should be in your executable PATH\n#                              /\nln -s ~/path/to/repo/ks/ks ~/bin/ks\n#                        \\\n#       This should point to the actual ks file\n```\n\nMake sure the file is executable. `chmod +x ~/path/to/ks`.\n\n\u003c/details\u003e\n\nNow you can `git pull` to get updates, modify your running installation and contribute easily.\n\nYou can also setup basic completions by adding `source \u003c(ks completion)` to your shell profile.\n\n## Usage\n\nUse the `ks help` command to get an overview of the commands:\n\n```\n$ ks help\nKeychain Secrets manager\n\nUsage:\n  ks [-k keychain] \u003ccommand\u003e [options]\n\nCommands:\n  add [-n] \u003ckey\u003e [value]    Add a secret (-n for note)\n  show \u003ckey\u003e                Decrypt and reveal a secret\n  cp \u003ckey\u003e                  Copy secret to clipboard\n  rm \u003ckey\u003e                  Remove secret from keychain\n  ls                        List secrets in keychain\n  rand [size]               Generate random secret\n  init                      Initialize selected keychain\n  help                      Show this help text\n  version                   Print version\n```\n\n### Add secrets\n\n```sh\nks add my-secret 'password123'\n# ⚠️ Note that this will add it to your shell history. ⚠️\n\n# Add a secret from your clipboard:\npbpaste | ks add my-secret\n# or\nks add my-secret \"$(pbpaste)\"\n\n# Generate high-entropy secret:\nks rand | ks add my-secret\n# or\nks add my-secret \"$(ks rand)\"\n\n# Mark secret as a \"note\" to get a multi-line UI in Keychain Access app\ncat long-text.txt | ks add -n my-secret-text\n```\n\n### Retrieve secrets\n\n```sh\n# Print out secret to stdout\nks show my-secret\n\n# Copy secret to clipboard\nks cp my-secret\n```\n\n### Remove secrets\n\n```sh\nks rm my-secret\n```\n\n### List secrets\n\n```sh\nks ls\n\n# You can filter with grep:\nks ls | grep 'prefix_'\n```\n\n## Using multiple keychains\n\nBy default, ks uses the `Secrets` keychain.\n\nYou can change this permanently by exporting a `KS_DEFAULT_KEYCHAIN` environment variable in your shell profile.\nEx: `export KS_DEFAULT_KEYCHAIN=\"AlternateKeychain\"`\n\nYou can also work with multiple keychains with ks. You can pick them on a per-command basis by using the `-k` argument right after the ks command.\n\nThis allows you to pick from which keychain you want to run the ks commands on.\n\nExamples:\n\n```sh\n# Create a \"ProjectA\" keychain\nks -k ProjectA init\n\n# Create a \"ProjectB\" keychain\nks -k ProjectB init\n\nks -k ProjectA add some-password 'password123'\nks -k ProjectB add some-password 'hunter2'\n\nks -k ProjectA show some-password\n# password123\nks -k ProjectB show some-password\n# hunter2\n```\n\n## iCloud sync\n\nYou can backup \u0026 sync your keychains between computers using cloud syncing software paired with a symlink. Here's an example for iCloud.\n\n1. Create a keychain for syncing (Optional)\n\nBy default, `ks` will create a `Secrets` keychain under `~/Library/Keychains/Secrets.keychain-db`. You can use this one for syncing, or create another one. Ex:\n\n```\n# Create a new keychain named iCloud\nks -k iCloud init\n```\n\n2. Move the keychain to the iCloud directory\n\n```\nmv \"/Users/$USER/Library/Keychains/iCloud.keychain-db\" \"/Users/$USER/Library/Mobile Documents/com~apple~CloudDocs/iCloud.keychain-db\"\n```\n\n3. Create a symlink to the keychain under the `~/Library/Keychains/` directory\n\n```\nln -s \"/Users/$USER/Library/Mobile Documents/com~apple~CloudDocs/iCloud.keychain-db\" \"/Users/$USER/Library/Keychains/iCloud.keychain-db\"\n```\n\n4. Repeat step 3 on every machine that needs syncing\n\nWait for the file to sync, then recreate the symlink from step 3 on the new computer. Pro tip: you can create and delete a folder to force the refresh of iCloud.\n\n## Who is this for\n\nThis is for you if:\n\n- You're on macOS.\n- You want to store and retrieve secrets using simple commands.\n- You want to leverage OS functionnality.\n\n\u003e Bonus: You don't like the idea of relying on a HTTP request, a third party server and a credit card subscription to access your secrets.\n\n---\n\nPRs, issues, comments and ideas are welcome.\n\nGive the repo a star if you like this!\n\nCrafted by [millisecond studio](https://millisecond.studio/) ❤️\n","funding_links":[],"categories":["Shell"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floteoo%2Fks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floteoo%2Fks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floteoo%2Fks/lists"}