SITL
The SITL (Software In The Loop) simulator allows you to run APM without any hardware. It is a build of the autopilot code using an ordinary C++ compiler and giving you a native executable that allows you to test the behaviour of the code without hardware.
Installation Ubuntu
Refer to the APM wiki for installation instructions.
Launch the simulator
sim_vehicle.sh -w
Instalation Mac OS
Install just the command line tools for OSX including GCC then get modules installed to Python:
sudo easy_install pip
sudo pip install pexpect
sudo pip install pyserial
Install MAVLink and MAVProxy:
sudo pip install pymavlink MAVProxy
(or) install MAVLink and MAVProxy from source
git clone https://github.com/tridge/MAVProxy
git clone https://github.com/tridge/mavlink
run this setup command in both directories
sudo python setup.py build install
Get the APM branch that compiles in Mac OS (this commit is relevant):
git clone https://github.com/erlerobot/ardupilot
cd ardupilot
git checkout macos
cd ArduCopter
make configure
make sitl
Source: drones-discuss