Fix serial communication on MacOS.