• Stars
    star
    916
  • Rank 47,896 (Top 1.0 %)
  • Language
    Objective-C
  • License
    Other
  • Created over 13 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

CLI for bluetooth on OSX: power, discoverable state, list, inquire devices, connect, info, …

blueutil

CLI for bluetooth on OSX: power, discoverable state, list, inquire devices, connect, info, …

Usage

Usage:
  blueutil [options]

Without options outputs current state

    -p, --power               output power state as 1 or 0
    -p, --power STATE         set power state
    -d, --discoverable        output discoverable state as 1 or 0
    -d, --discoverable STATE  set discoverable state

        --favourites, --favorites
                              list favourite devices
        --inquiry [T]         inquiry devices in range, 10 seconds duration by default excluding time for name updates
        --paired              list paired devices
        --recent [N]          list recently used devices, 10 by default, 0 to list all
        --connected           list connected devices

        --info ID             show information about device
        --is-connected ID     connected state of device as 1 or 0
        --connect ID          create a connection to device
        --disconnect ID       close the connection to device
        --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
        --unpair ID           EXPERIMENTAL unpair the device
        --add-favourite ID, --add-favorite ID
                              add to favourites
        --remove-favourite ID, --remove-favorite ID
                              remove from favourites

        --format FORMAT       change output format of info and all listing commands

        --wait-connect ID [TIMEOUT]
                              EXPERIMENTAL wait for device to connect
        --wait-disconnect ID [TIMEOUT]
                              EXPERIMENTAL wait for device to disconnect
        --wait-rssi ID OP VALUE [PERIOD [TIMEOUT]]
                              EXPERIMENTAL wait for device RSSI value which is 0 for golden range, -129 if it cannot be read (e.g. device is disconnected)

    -h, --help                this help
    -v, --version             show version

STATE can be one of: 1, on, 0, off, toggle
ID 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 used devices
OP can be one of: >, >=, <, <=, =, !=; or equivalents: gt, ge, lt, le, eq, ne
PERIOD is in seconds, defaults to 1
TIMEOUT is in seconds, default value 0 doesn't add timeout
FORMAT can be one of:
  default - human readable text output not intended for consumption by scripts
  new-default - human readable comma separated key-value pairs (EXPERIMENTAL, THE BEHAVIOUR MAY CHANGE)
  json - compact JSON
  json-pretty - pretty printed JSON

Due to possible problems, blueutil will refuse to run as root user (see https://github.com/toy/blueutil/issues/41).
Use environment variable BLUEUTIL_ALLOW_ROOT=1 to override (sudo BLUEUTIL_ALLOW_ROOT=1 blueutil …).

Exit codes:
   0 Success
   1 General failure
  64 Wrong usage like missing or unexpected arguments, wrong parameters
  69 Bluetooth or interface not available
  70 Internal error
  71 System error like shortage of memory
  75 Timeout error

Install/update/uninstall

Homebrew

Using package manager Homebrew:

# install
brew install blueutil

# update
brew update
brew upgrade blueutil

# uninstall
brew remove blueutil

MacPorts

Using package manager MacPorts:

# install
port install blueutil

# update
port selfupdate
port upgrade blueutil

# uninstall
port uninstall blueutil

You will probably need to prefix all commands with sudo.

From source

git clone https://github.com/toy/blueutil.git
cd blueutil

# build
make

# install/update
git pull
make install

# uninstall
make uninstall

You may need to prefix install/update and uninstall make commands with sudo.

Notes

Uses private API from IOBluetooth framework (i.e. IOBluetoothPreference*()).

Opening 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.

Development

To build and update usage:

make build update_usage

To apply clang-format:

make format

To test:

make test

To release new version:

./release major|minor|patch

To create release on github:

./verify_release

If there are no validation errors, copy generated markdown to description of new release:

open "https://github.com/toy/blueutil/releases/new?tag=$(git describe --tags --abbrev=0)"

Copyright

Originally written by Frederik Seiffert [email protected] http://www.frederikseiffert.de/blueutil/

Copyright (c) 2011-2023 Ivan Kuchin. See LICENSE.txt for details.

More Repositories

1

image_optim

Optimize images using multiple utilities
Ruby
1,503
star
2

dump

Rails app rake and capistrano tasks to create and restore dumps of database and assets
Ruby
89
star
3

image_size

measure image size using pure Ruby (by Keisuke Minami)
Ruby
83
star
4

image_optim_pack

Precompiled binaries for image_optim
Ruby
77
star
5

progress

Class to show progress during script run
Ruby
68
star
6

pHash

Ruby interface to pHash
Ruby
60
star
7

image_optim_rails

Optimize rails assets using image_optim
Ruby
53
star
8

in_threads

Run all possible enumerable methods in concurrent/parallel threads
Ruby
37
star
9

sdoc_all

sdoc_all is no longer maintained, try doc gem
Ruby
15
star
10

random_text

Class to make access to http://vesna.yandex.ru/ and http://lipsum.com/ easier
Ruby
10
star
11

output_compression

gzip compression output - it is just a mirror with applied patches
Ruby
9
star
12

rbenv-update-rubies

Update rbenv ruby versions
Shell
7
star
13

phamilie

Compute image fingerprints and similarity
Ruby
7
star
14

doc

Command line tool to get searchable documentation for ruby, rails, gems, plugins and other ruby related code in one place
Ruby
6
star
15

free_mem

Free memory on mac
C
6
star
16

tms

Time Machine Status
Ruby
5
star
17

upload_column

upload_column 0.2.1 with some fixes
Ruby
5
star
18

FinderPatch

Finder fixes: select next after trashing, label shortcuts, open in terminal, open in textmate
Objective-C
5
star
19

fspath-mac

FSPath methods for mac
Objective-C
5
star
20

fspath

Better than Pathname
Ruby
4
star
21

spec_routes_tester

Plugin with class that allows you much easier routes testing with rspec
Ruby
4
star
22

mate

TextMate project builder and TextMate 2 properties builder using git ignores for exclusions
Ruby
4
star
23

extended_form_helper

Helper methods to ease form creation
Ruby
4
star
24

cache_method

cache method result in attribute
Ruby
3
star
25

contacts

store a lot of contacts in one text field with validation and link creation
Ruby
3
star
26

data_columns

Store multiple columns in serialized data column
Ruby
3
star
27

rbenv-around-install

Run scripts before and after installing ruby using ruby-build
Shell
3
star
28

fspath-xattr

FSPath methods xattr and lxattr to work with extended attributes using ffi-xattr gem
Ruby
3
star
29

set_icon

set/unset custom icon for file
Objective-C
3
star
30

access

Plugin for writing allow/deny rules in controllers
Ruby
3
star
31

growler

Growl like messages in rails app
JavaScript
2
star
32

remove_stale_gems

remove unused gems
Ruby
2
star
33

toy.github.com

toy.github.com
JavaScript
2
star
34

toy

✨special✨ repository
2
star
35

TmCleanSave

TextMate bundle which removes extra whitespace and fixes tabs when saving file
C
2
star
36

russian

String methods to ease work with russian language
Ruby
2
star
37

ui

repository to easily distribute compiled ui reference
PHP
2
star
38

link.app

Create hardlink/symlink (alt to force symlink) for items selected in Finder
Objective-C
2
star
39

newTabHere.app

open new Terminal tab next to current with same dir
Objective-C
2
star
40

box-for-rubygems

Shell
1
star
41

restartable

Run code, Ctrl-C to restart, two Ctrl-C to stop
Ruby
1
star
42

as

repository to easily distribute compiled actionscript reference
JavaScript
1
star
43

rbenv-with

rbenv with 2.4
Shell
1
star
44

simple_scaffold

simple_scaffold
1
star
45

rb

repository to easily distribute compiled rb reference
JavaScript
1
star
46

Appscript

clone of Obj-C appscript
Objective-C
1
star
47

TerminalPatch

New Terminal tab/window with same dir
Objective-C
1
star
48

rake-gem-ghost

Help gem developers to test created gems β€” creates symlink from installed gem to current folder.
Ruby
1
star
49

SilverService

fork of application to make mac os x services from unix commands
Objective-C
1
star
50

fix_html

helper to make html valid
Ruby
1
star
51

server_dotfiles

server dotfiles
1
star
52

xcode

Rake tasks to help packaging products made with Xcode.
Ruby
1
star
53

rails_seeder

Helpers to generate test data
Ruby
1
star
54

rb-appscript

because it still works even for ruby 3.0
Ruby
1
star