Most of the time you should be fairly safe.
OS-X is based on BSD which, like Linux, is a variant of Unix, albeit one of the more different versions.
It does however have very similar kernel and OS calls, and is considered to be Posix compliant, which is the main thing needed for cross platform operation.
The biggest issue your going to face when it comes to Apple's variation on things are
- CPU & Processor architecture.
- Additions made to the OS kernel but not released back into the wild.
Taking each of these in turn:
CPU & Processor architecture
All apple machines manufactured since 2007 have Intel based CPU's in them, however older apple machines used a variety of different CPU types ranging from the Motorola 68000 right through to the IBM PowerPC.
Some Linux projects do have in-line assembly language in them, especially things that are designed to interface to the kernel at a very low level.
On a modern day Apple with an Intel, this is not really too much of an issue, but if your trying to compile for something with a non Intel CPU in, your going to have problems.
Thankfully however, because of Linux's philosophy and open-source nature, this kind of practice is frowned upon, and very rarely seen in regular applications and tools.
Also, where an application is known to have platform specific parts in, there is often a ./configure script to run that 'configures' the sources for the platform being built on, or there is some way of specifying what the build target should be.
Additions made to the OS kernel but not released back into the wild
Apple are well known for putting thier own spin on things, and while I'm not an Apple developer (so I can't say for 100% what is and is not added), I do know a lot of other developers who are.
Going on the various comments and things I've been told by others, there are a number of OS facilities that are only available in Apples variation of the Linux base OS, and in some cases, developers are encouraged to use these in place of regular calls.
This really however, should only affect the porting of applications going the other way, in so much that, the target platform is tied to being apple and not easily portable to other variants.
Bringing in external apps should not be much of an issue as long as the application uses only standard posix based API calls, and does not try to do anything special or clever, or make any assumptions about the environment in which it is running.
The area where your likely to have the most trouble, is in the GUI space. Beacuse the GUI is so closely tied to the windowing library, and the windowing library is where most of Apples 3rd party extensions lie, then IMHO if any type of application is going to present you with a whole heap of problems, it's going to be here.
Most of the generic Linux stuff is designed to run under either a Generic X server, or using a toolkit such as Gnome or Kde, both of which (Correct me if I'm wrong here) I'm let to believe are not available on OS-X.
./configure
<->make
... orgcc blahblah.c blahblah.h -o blahblah
. I do that a lot. Again, it doesn't seem to pose problems for me, but since science demands accuracy, it would good to know what the differences in architecture, so I can determine when I should not do what I'm doing.