Well OK...
More or less like writing any kind of virus.
Apple likes to claim that OS X is more secure. In reality, most of those who write malware own Windows boxen.