I know that I can turn iOS devices into iBeacons (Can an iOS7 device act as an iBeacon?). Unfortunately, I only have one device and my beacons have not arrived yet. So I was wondering how I could turn my MacBook Air (Mid-2011, does support Bluetooth 4.0) into an iBeacon for testing purposes. Are there any ready-made applications available like the airlocate for iOS? Thanks in advance!
7 Answers
Note: This only works in Mavericks, it does NOT work in Yosemite.
Mavericks doesn't have the iBeacon support in Core Location that was added to iOS 7. However, Mavericks does now have the ability to act as an BLE peripheral device. Given that an iBeacon is basically a peripheral it should be (and indeed is) possible to use Mavericks as an iBeacon.
In order to create an iBeacon on iOS you first create a CLBeaconRegion
object and then use the peripheralDataWithMeasuredPower:
method to get an NSDictionary
containing the necessary advertisement data to broadcast. If you take the contents of this NSDictionary
from an iOS device and use it on Mavericks then you get an iBeacon.
I have created a class to make this easier and allow you to generate the advertisement data dictionary directly on Mavericks. The source code is available at https://github.com/mttrb/BeaconOSX
The BLCBeaconAdvertisementData
class take the proximityUUID
, major
, minor
and calibrated power values and creates an NSDictionary that can be passed to the startAdvertising:
method of CBPeripheralManager
on Mavericks.
The BLCBeaconAdvertisementData
class is quite simple. The main work is done by the following method:
- (NSDictionary *)beaconAdvertisement {
NSString *beaconKey = @"kCBAdvDataAppleBeaconKey";
unsigned char advertisementBytes[21] = {0};
[self.proximityUUID getUUIDBytes:(unsigned char *)&advertisementBytes];
advertisementBytes[16] = (unsigned char)(self.major >> 8);
advertisementBytes[17] = (unsigned char)(self.major & 255);
advertisementBytes[18] = (unsigned char)(self.minor >> 8);
advertisementBytes[19] = (unsigned char)(self.minor & 255);
advertisementBytes[20] = self.measuredPower;
NSMutableData *advertisement = [NSMutableData dataWithBytes:advertisementBytes length:21];
return [NSDictionary dictionaryWithObject:advertisement forKey:beaconKey];
}
I have a more detailed blog post about this at http://www.blendedcocoa.com/blog/2013/11/02/mavericks-as-an-ibeacon/

- 8,297
- 3
- 35
- 57
-
Although, your solutions seems to be the only one available around, I cannot get it working. I have MacBook Retina late 2013 with Maveriks installed and manufacturer iBeacons to compare with. Air Locate iOS app can range only the chip, not MacBook. Passbook behaves the same. Could you please advise? – Yevhen Dubinin Dec 07 '13 at 00:58
-
1The two usual reasons that the iBeacon doesn't work on MacBooks is that the MacBook doesn't support BLE (unlikely if you have a 2013 MacBook) and that Bluetooth is turned off in System Preferences. The other issue could be to do with the `proximityUUID` that the Mac is broadcasting. – mttrb Dec 09 '13 at 02:25
The best solution I've found so far is this one from Tim Duckett: https://github.com/timd/MactsAsBeacon
Just grab the project, set up a UUID, major, and minor value and click Broadcast. Really simple. The solution is based upon this blog post: http://www.blendedcocoa.com/blog/2013/11/02/mavericks-as-an-ibeacon/

- 6,960
- 1
- 33
- 42
This is possible with OSX Mavericks, but not in Mountain Lion and earlier versions of the OS. My company, Radius Networks, has a MacBeacon app that does this on Mavericks.
In OSX Mountain Lion, unlike iOS 6+, there is no built-in support for the Bluetooth peripheral mode you need to advertise like an iBeacon. This means rolling your own low-level Bluetooth code, which is not easy to say the least.
But there is a solution for older operating systems. I paired an external Bluetooth dongle on my Mac with a VirtualBox VM running Linux and achieved what you are looking for. My company made this VM available for a free download here: http://developer.radiusnetworks.com/ibeacon/

- 63,876
- 14
- 121
- 204
-
According to the documentation on mavrick 10.9 it should be possible. But I can't for the life of me get it up and running. I'm not able to locate the CLBeacon class in 10.9 so either this is done in some other way in 10.9 or my version is flawed. – Ronny Khan Oct 24 '13 at 18:27
-
Yep, it can work in Mavericks. I saw a colleague demonstrate it. Just updated my answer to reflect this. – davidgyoung Oct 27 '13 at 01:52
-
OS X 10.9 supports CBPeripheralManager, but I see no evidence of CLBeacon within CoreLocation. So although Mavericks can advertise like a peripheral, I see no evidence of iBeacon support specifically. Please provide evidence of this in the documentation. – Bob Kressin Oct 27 '13 at 06:05
-
So would this virtual machine work with a PC with a USB BTLE dongle? – Brad Parks Mar 06 '14 at 02:21
-
Yes! It works on Windows, too. I tried it on a Vista laptop with the IOGear Bluetooth nub. – davidgyoung Mar 06 '14 at 03:21
-
@davidgyoung were you able to control the range at which an entry would be triggered? similar to how in radius networks' beacons you can set a low power advertisement to reduce the entry range? – fjlksahfob May 19 '14 at 19:57
-
1Unfortunately, no, this is not possible at least with the IOGear bluetooth stick. Other bluetooth sticks may provide power control functionality. – davidgyoung May 19 '14 at 20:48
If you want to save the 9.99€ take a look at the latest Version of the open source client by mttrb. I added some more GUI so you can adjust all the fields. https://github.com/deadfalkon/BeaconOSX/releases even has a binary download.

- 1,095
- 1
- 12
- 22
-
Nice! Especially the precompiled binary helps anyone not comfortable with Xcode / still punting on paying Apple $99. – Simon B. Jul 15 '14 at 07:19
-
3For XCode and running code on your local machine, you don´t need a developer program! – volkersfreunde Jul 23 '14 at 11:05
I tried all these solutions, but couldn't get AirLocate to pick up a signal until I complied this: https://github.com/lgaches/BeaconEmitter and started transmitting with this UUID: E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 and with an identifier of: hello
I found this post about AirLocate useful as well: Does AirLocate only look for particular UUIDs?
Yep its possible. Check out this github project https://github.com/nolim1t/iBeaconAdvertisement

- 4,051
- 1
- 17
- 7
The only utility to turn a Mac into an iBeacon that worked for me under El Capitan (OS X 10.11) was iBeaconSwiftOSX. Also reported to work under Yosemite (OS X 10.10). The (free) iOS scanning utility used was iBeacon Loc from Eurelis.
FYI: on iOS, a scanner MUST search for a SPECIFIC combination of UUID and major/minor advertised by an iBeacon. Make sure scanner setup and iBeacon setup match.

- 815
- 10
- 16