Building ArduPilot for Pixhawk/PX4 on Mac with Make¶
This article shows how to build ArduPilot for Pixhawk 2, Pixhawk and PX4 on Mac OS X (ver 10.6 onwards) with Make.
The commands for building for the Pixhawk and Pixhawk2 are identical (
make px4-v2). To build for Pixracer replace
make px4-v2 with
make px4-v4 in the instructions below. For the original (obsolete) PX4 use
Install Homebrew for Mac OS X
Install xcode and say YES to install Command Line Tools
Install the following packages using brew
brew tap PX4/homebrew-px4 brew update brew install genromfs brew install gcc-arm-none-eabi
Install the latest version of awk using brew (make sure /usr/local/bin takes precedence in your path):
brew install gawk
Install pip and pyserial using the following commands:
sudo easy_install pip sudo pip install pyserial future catkin_pkg empy
Now create your directory and install all the software:
mkdir -p px4 cd px4 git clone https://github.com/ArduPilot/ardupilot.git cd ardupilot git submodule update --init --recursive
Choose a firmware type to build by entering a subdirectory; e.g.:
Build the firmware by entering one of the following commands:
Build the Pixhawk2/Pixhawk firmware (identical) for a quad
Build the Pixhawk firmware for a hexacopter.
# Other supported suffixes include “octa”, “tri” and “heli”.
# More can be found in “mk/tagets.mk” under FRAMES
Build both PX4 and PixHawk firmware for a quadcopter
“clean” the ardupilot directory
“clean” the PX4Firmware and PX4NuttX directories so the next build will completely rebuild them
Build and upload the Pixhawk firmware for a quad (i.e. no need to do step #7 below)
The firmware will be created in the ArduCopter directory with the .px4 file extension, ready to load onto the Pixhawk. For example if you build for px4-v2, ArduCopter-v2.px4 will be created
Occasionally you should pull PX4Firmware and PX4NuttX updates. To make sure it compiles correctly, run the clean option in make:
make px4-clean make px4-[frame type]
The available frame types are: quad, tri, hexa, y6, octa, octa-quad, hell.
To make and upload to your vehicle do: