Arduino nano and Xcode

I want to use Xcode to control LEDS connected to an arduino nano. When I use the serial monitor everything works fine. However when I use the popen command like this:
popen("echo 12 > /dev/cu.wchusbserial1410", "r");
nothing happens. I see on the arduino that it is receding something but apparently not the command that I'm sending. I use the Serial.parseInt(); in the arduino to read in commands.
I have another Uno board controlled by Xcode working fine. How can it be different this time? Is the nano board special?

How about posting the code that works and the code that doesn't work ?

Please read this before posting a programming question

I have another Uno board controlled by Xcode working fine. How can it be different this time? Is the nano board special?

The Nano (at least the original one from Arduino) uses an FTDI chip for the USB-to-serial conversion while the UNO uses an ATmega16U2 with a special firmware to do the same. On the Arduino side this behaves identical but I strongly guess that your Mac is using different drivers for the two and the two drivers seem to behave differently. Maybe you don't have write permission on the device? What do you get if you execute the commands in a terminal?