Be sure the command is on a single line, as usual with command line syntax. How to Get the Serial Number of a Mac from Command Line in Mac OS X To try this yourself and get the serial number on any Mac OS machine, enter the appropriate command string below at the Terminal, depending on the version of Mac OS X in use on the Mac. The following Mac OS X GUI applications are available: Having installed the right driver for our USB-serial adapter, we also need to install some terminal emulation software before we can connect to anything.