The modern approach to your problem is to configure the barcode scanner to use the so-called HID POS or USB OEM mode. In that mode, the scanner remains connected to the computer directly via USB but it won't send keyboard presses any more but rather codes similar to what you get with the serial port mode.
The USB HID specificaton does define the codes for barcode scanners, and some scanners, like the ones made by GoDEX, follow this protocol. You'll have to implement some USB specific code in your OS X app for this, using the IOKit API for user space handling. But I found it not too difficult to accomplish.
However, some scanners, like those made by Datalogic, do not use the official HID protocol for scanners. Instead, they use a private protocol that's not publically documented. With some reverse engineering and digging I figured out that protocol as well, though.
See my question "Enable USB-OEM (HID POS) mode in a Datalogic barcode scanner" for details on that.
But if you don't want to go down this route of writing your own USB handlers, you can always just get a common Serial-to-USB adapter and install a matching serial driver on your Mac, and then use the scanner in serial mode. When getting a serial adapter, there are two general types: One uses a Prolific chipset, the other an FTDI chipset. The Prolific ones are badly supported by the manufacturer - their drivers are outdated and do not even support the full range of control lines (CTS, RTS etc.). However, there's an independent driver that I can recommend: https://www.mac-usb-serial.com - it's not free but it's well supported and I can confirm that it's working reliably with a Datalogic barcode scanner over the serial port and connected to a Mac via a Prolific-based adapter.