Use terminal command to verify software
I managed to verify code from terminal by invoking /Applications/Arduino.app/Contents/MacOS/Arduino --verify lab.ino BUT this command automatically starts the IDE and exits it afterwards. Even with an IDE instance open it will start a new one. This is annoying since it will switch the active workspace away, but it kinda works. See arduino manpage.