Skip to content
Scott Yoder edited this page Aug 29, 2015 · 2 revisions

Installing prerequisites

sudo apt-get install ruby ruby-dev bluetooth bluez libbluetooth-dev

Issues with permissions

In order to use this gem with BlueZ, you need to have root privileges. Either you will need to run your Ruby script with sudo, or you will need to assign the appropriate permissions via setcap.

In order to use setcap, you first need to make sure it is installed:

sudo apt-get install libcap2-bin

Then you can set the permissions:

sudo setcap 'cap_net_raw,cap_net_admin+eip' <path-to-ruby-binary-here>

Notes:

  • you cannot use setcap on a link, it has to be the actual Ruby binary.
  • If you are using RVM and use setcap on your Ruby binary, you need to be aware of this issue: https://github.com/rvm/rvm/issues/2925. The upshot is that until this issue is fixed, if you are using a pre-built binary from RVM you may have to re-install from source:
rvm reinstall 2.1.2 --disable-binary
Clone this wiki locally