{"id":13496288,"url":"https://github.com/toy/blueutil","last_synced_at":"2025-05-15T12:02:57.175Z","repository":{"id":41203251,"uuid":"1306693","full_name":"toy/blueutil","owner":"toy","description":"CLI for bluetooth on OSX: power, discoverable state, list, inquire devices, connect, info, …","archived":false,"fork":false,"pushed_at":"2025-02-02T16:01:38.000Z","size":101,"stargazers_count":1126,"open_issues_count":29,"forks_count":56,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-05-15T01:22:50.350Z","etag":null,"topics":["bluetooth","blueutil","macos","objective-c","osx"],"latest_commit_sha":null,"homepage":"https://github.com/toy/blueutil","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/toy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2011-01-29T18:05:05.000Z","updated_at":"2025-05-13T12:40:27.000Z","dependencies_parsed_at":"2024-04-17T20:45:37.812Z","dependency_job_id":"bd9867b0-f0ef-4636-a692-ed3a3c68d2d4","html_url":"https://github.com/toy/blueutil","commit_stats":{"total_commits":122,"total_committers":3,"mean_commits":"40.666666666666664","dds":0.05737704918032782,"last_synced_commit":"6477e3d210fc6662c021fd39a3e3cfd6f71fdf7e"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toy%2Fblueutil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toy%2Fblueutil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toy%2Fblueutil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toy%2Fblueutil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/toy","download_url":"https://codeload.github.com/toy/blueutil/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254337612,"owners_count":22054253,"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":["bluetooth","blueutil","macos","objective-c","osx"],"created_at":"2024-07-31T19:01:45.214Z","updated_at":"2025-05-15T12:02:57.139Z","avatar_url":"https://github.com/toy.png","language":"Objective-C","readme":"# blueutil\n\nCLI for bluetooth on OSX: power, discoverable state, list, inquire devices, connect, info, …\n\n## Notes\n\nUses private API from IOBluetooth framework (i.e. `IOBluetoothPreference*()`).\n\nOpening Bluetooth preference pane always turns on discoverability if bluetooth power is on or if it is switched on when preference pane is open, this change of state is not reported by the function used by `blueutil`.\n\n## Usage\n\n\u003c!--USAGE[--\u003e\n```\nUsage:\n  blueutil [options]\n\nWithout options outputs current state\n\n    -p, --power               output power state as 1 or 0\n    -p, --power STATE         set power state\n    -d, --discoverable        output discoverable state as 1 or 0\n    -d, --discoverable STATE  set discoverable state\n\n        --favourites, --favorites\n                              list favourite devices; returns empty list starting with macOS 12/Monterey\n        --inquiry [T]         inquiry devices in range, 10 seconds duration by default excluding time for name updates\n        --paired              list paired devices\n        --recent [N]          list recently used devices, 10 by default, 0 to list all; returns empty list starting with macOS 12/Monterey\n        --connected           list connected devices\n\n        --info ID             show information about device\n        --is-connected ID     connected state of device as 1 or 0\n        --connect ID          create a connection to device\n        --disconnect ID       close the connection to device\n        --pair ID [PIN]       pair with device, optional PIN of up to 16 characters will be used instead of interactive input if requested in specific pair mode\n        --unpair ID           EXPERIMENTAL unpair the device\n        --add-favourite ID, --add-favorite ID\n                              add to favourites; does nothing starting with macOS 12/Monterey\n        --remove-favourite ID, --remove-favorite ID\n                              remove from favourites; does nothing starting with macOS 12/Monterey\n\n        --format FORMAT       change output format of info and all listing commands\n\n        --wait-connect ID [TIMEOUT]\n                              EXPERIMENTAL wait for device to connect\n        --wait-disconnect ID [TIMEOUT]\n                              EXPERIMENTAL wait for device to disconnect\n        --wait-rssi ID OP VALUE [PERIOD [TIMEOUT]]\n                              EXPERIMENTAL wait for device RSSI value which is 0 for golden range, -129 if it cannot be read (e.g. device is disconnected)\n\n    -h, --help                this help\n    -v, --version             show version\n\nSTATE can be one of: 1, on, 0, off, toggle\nID can be either address in form xxxxxxxxxxxx, xx-xx-xx-xx-xx-xx or xx:xx:xx:xx:xx:xx, or name of device to search in paired or recent devices\nOP can be one of: \u003e, \u003e=, \u003c, \u003c=, =, !=; or equivalents: gt, ge, lt, le, eq, ne\nPERIOD is in seconds, defaults to 1\nTIMEOUT is in seconds, default value 0 doesn't add timeout\nFORMAT can be one of:\n  default - human readable text output not intended for consumption by scripts\n  new-default - human readable comma separated key-value pairs (EXPERIMENTAL, THE BEHAVIOUR MAY CHANGE)\n  json - compact JSON\n  json-pretty - pretty printed JSON\n\nFavourite devices and recent access date are not stored starting with macOS 12/Monterey, current time is returned for recent access date by framework instead.\n\nDue to possible problems, blueutil will refuse to run as root user (see https://github.com/toy/blueutil/issues/41).\nUse environment variable BLUEUTIL_ALLOW_ROOT=1 to override (sudo BLUEUTIL_ALLOW_ROOT=1 blueutil …).\n\nExit codes:\n   0 Success\n   1 General failure\n  64 Wrong usage like missing or unexpected arguments, wrong parameters\n  69 Bluetooth or interface not available\n  70 Internal error\n  71 System error like shortage of memory\n  75 Timeout error\n 134 Abort signal may indicate absence of access to Bluetooth API\n```\n\u003c!--]USAGE--\u003e\n\n## Install/update/uninstall\n\n### Homebrew\n\nUsing package manager [Homebrew](https://brew.sh/):\n\n```sh\n# install\nbrew install blueutil\n\n# update\nbrew update\nbrew upgrade blueutil\n\n# uninstall\nbrew remove blueutil\n```\n\n### MacPorts\n\nUsing package manager [MacPorts](https://www.macports.org/):\n\n```sh\n# install\nport install blueutil\n\n# update\nport selfupdate\nport upgrade blueutil\n\n# uninstall\nport uninstall blueutil\n```\n\nYou will probably need to prefix all commands with `sudo`.\n\n### From source\n\n```sh\ngit clone https://github.com/toy/blueutil.git\ncd blueutil\n\n# build\nmake\n\n# install/update\ngit pull\nmake install\n\n# uninstall\nmake uninstall\n```\n\nYou may need to prefix install/update and uninstall make commands with `sudo`.\n\n## Alternative Interface\nFor a TUI (text-based user interface) build on top of `blueutil`, you can take a look at [blueutil-tui](https://github.com/Zaloog/blueutil-tui).\nIt offers a simple interface for the following `blueutil` functionalities:\n- displaying paired devices\n- searching devices\n- pairing and unpairing devices\n- connecting and disconnecting devices\n\nIt's written in python using the [textual](https://textual.textualize.io) framework.\n\n## Development\n\nTo build and update usage:\n\n```sh\nmake build update_usage\n```\n\nTo apply clang-format:\n\n```sh\nmake format\n```\n\nTo test:\n\n```sh\nmake test\n```\n\nTo release new version:\n\n```sh\n./release major|minor|patch\n```\n\nTo create release on github:\n\n```sh\n./verify_release\n```\n\nIf there are no validation errors, copy generated markdown to description of new release:\n\n```sh\nopen \"https://github.com/toy/blueutil/releases/new?tag=$(git describe --tags --abbrev=0)\"\n```\n\n## Copyright\n\nOriginally written by Frederik Seiffert ego@frederikseiffert.de http://www.frederikseiffert.de/blueutil/\n\nCopyright (c) 2011-2025 Ivan Kuchin. See [LICENSE.txt](LICENSE.txt) for details.\n","funding_links":[],"categories":["Objective-C","其它实用工具"],"sub_categories":["系统相关工具"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoy%2Fblueutil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoy%2Fblueutil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoy%2Fblueutil/lists"}