[WIP] Hacky fixes for macOS Gazebo build
This PR contains every step I took to be able to run new Gazebo sim after running ./Tools/setup/macos.sh --sim-tools --reinstall setup bash file on my own system.
I have created this PR as a side note till we can fix them one by one.
Relevant PRs/Issues:
1 . https://github.com/PX4/PX4-Autopilot/issues/25794 2. https://github.com/PX4/PX4-Autopilot/issues/25205 3. https://github.com/PX4/PX4-Autopilot/issues/24192 4. https://github.com/PX4/PX4-Autopilot/pull/25957 5. https://github.com/PX4/PX4-Autopilot/pull/25935 6. https://github.com/PX4/PX4-Autopilot/pull/25767 7. https://github.com/PX4/PX4-Autopilot/pull/25204
🔎 FLASH Analysis
px4_fmu-v5x [Total VM Diff: 120 byte (0.01 %)]
FILE SIZE VM SIZE
-------------- --------------
+0.0% +120 +0.0% +120 .text
+3.0% +148 +3.0% +148 uavcan::GenericSubscriber<>::checkInit()
[NEW] +108 [NEW] +108 CSWTCH.151
[NEW] +84 [NEW] +84 CSWTCH.188
[NEW] +60 [NEW] +60 CSWTCH.1931
[NEW] +44 [NEW] +44 CSWTCH.2711
+275% +44 +275% +44 CSWTCH.55
[NEW] +28 [NEW] +28 CSWTCH.22
+12% +16 +12% +16 px4::wq_configurations::lp_default
[NEW] +14 [NEW] +14 CSWTCH.3459
[NEW] +14 [NEW] +14 CSWTCH.3460
-100.1% -8 -100.1% -8 [19 Others]
[DEL] -14 [DEL] -14 CSWTCH.3451
[DEL] -14 [DEL] -14 CSWTCH.3452
-2.3% -16 -2.3% -16 px4::logger::Logger::initialize_topics()
-0.0% -20 -0.0% -20 [section .text]
[DEL] -28 [DEL] -28 CSWTCH.15
[DEL] -44 [DEL] -44 CSWTCH.2703
[DEL] -44 [DEL] -44 CSWTCH.51
[DEL] -60 [DEL] -60 CSWTCH.1923
[DEL] -84 [DEL] -84 CSWTCH.186
[DEL] -108 [DEL] -108 CSWTCH.150
+0.0% +105 [ = ] 0 .debug_abbrev
-0.0% -8 [ = ] 0 .debug_frame
-0.0% -4.64Ki [ = ] 0 .debug_info
+0.0% +628 [ = ] 0 .debug_line
[DEL] -1 [ = ] 0 [Unmapped]
+0.0% +629 [ = ] 0 [section .debug_line]
-0.0% -162 [ = ] 0 .debug_loclists
+0.0% +21 [ = ] 0 .debug_rnglists
[NEW] +2 [ = ] 0 [Unmapped]
+0.0% +19 [ = ] 0 [section .debug_rnglists]
-0.0% -31 [ = ] 0 .debug_str
-0.8% -2 [ = ] 0 .shstrtab
-0.0% -10 [ = ] 0 .strtab
[DEL] -14 [ = ] 0 C.22.0
[NEW] +14 [ = ] 0 C.25.0
[DEL] -7 [ = ] 0 C.53.0
[NEW] +7 [ = ] 0 C.63.0
[DEL] -10 [ = ] 0 CSWTCH.15
[DEL] -11 [ = ] 0 CSWTCH.150
[NEW] +11 [ = ] 0 CSWTCH.151
[DEL] -11 [ = ] 0 CSWTCH.186
[NEW] +11 [ = ] 0 CSWTCH.188
[DEL] -12 [ = ] 0 CSWTCH.1923
[NEW] +12 [ = ] 0 CSWTCH.1931
[NEW] +10 [ = ] 0 CSWTCH.22
[DEL] -12 [ = ] 0 CSWTCH.2703
[NEW] +12 [ = ] 0 CSWTCH.2711
[DEL] -24 [ = ] 0 CSWTCH.3451
[DEL] -24 [ = ] 0 CSWTCH.3452
[NEW] +24 [ = ] 0 CSWTCH.3459
[NEW] +24 [ = ] 0 CSWTCH.3460
[DEL] -10 [ = ] 0 CSWTCH.51
-144.4% -16 [ = ] 0 [1 Others]
+36% +16 [ = ] 0 ___ZL19param_get_cplusplustPf.isra.0_veneer
-1.1% -120 [ = ] 0 [Unmapped]
-0.0% -4.11Ki +0.0% +120 TOTAL
px4_fmu-v6x [Total VM Diff: 144 byte (0.01 %)]
FILE SIZE VM SIZE
-------------- --------------
+0.0% +144 +0.0% +144 .text
+3.0% +148 +3.0% +148 uavcan::GenericSubscriber<>::checkInit()
[NEW] +108 [NEW] +108 CSWTCH.151
[NEW] +84 [NEW] +84 CSWTCH.188
[NEW] +60 [NEW] +60 CSWTCH.1931
[NEW] +44 [NEW] +44 CSWTCH.2711
+275% +44 +275% +44 CSWTCH.55
[NEW] +28 [NEW] +28 CSWTCH.22
[NEW] +28 [NEW] +28 _GLOBAL__sub_I__ZN11I2CLauncherC2Eii
[NEW] +14 [NEW] +14 CSWTCH.3459
[NEW] +14 [NEW] +14 CSWTCH.3460
-100.0% +12 -100.0% +12 [21 Others]
[DEL] -14 [DEL] -14 CSWTCH.3451
[DEL] -14 [DEL] -14 CSWTCH.3452
-2.3% -16 -2.3% -16 px4::logger::Logger::initialize_topics()
[DEL] -28 [DEL] -28 CSWTCH.15
[DEL] -28 [DEL] -28 _GLOBAL__sub_I__ZN11I2CLauncher8_devicesE
[DEL] -44 [DEL] -44 CSWTCH.2703
[DEL] -44 [DEL] -44 CSWTCH.51
[DEL] -60 [DEL] -60 CSWTCH.1923
[DEL] -84 [DEL] -84 CSWTCH.186
[DEL] -108 [DEL] -108 CSWTCH.150
+0.0% +39 [ = ] 0 .debug_abbrev
-0.0% -8 [ = ] 0 .debug_frame
-0.0% -4.63Ki [ = ] 0 .debug_info
+0.0% +926 [ = ] 0 .debug_line
+600% +6 [ = ] 0 [Unmapped]
+0.0% +920 [ = ] 0 [section .debug_line]
-0.0% -139 [ = ] 0 .debug_loclists
+0.0% +14 [ = ] 0 .debug_rnglists
-0.0% -31 [ = ] 0 .debug_str
+0.9% +2 [ = ] 0 .shstrtab
-0.0% -10 [ = ] 0 .strtab
[DEL] -14 [ = ] 0 C.22.0
[NEW] +14 [ = ] 0 C.25.0
[DEL] -7 [ = ] 0 C.53.0
[NEW] +7 [ = ] 0 C.63.0
[DEL] -10 [ = ] 0 CSWTCH.15
[DEL] -11 [ = ] 0 CSWTCH.150
[NEW] +11 [ = ] 0 CSWTCH.151
[DEL] -11 [ = ] 0 CSWTCH.186
[NEW] +11 [ = ] 0 CSWTCH.188
[DEL] -12 [ = ] 0 CSWTCH.1923
[NEW] +12 [ = ] 0 CSWTCH.1931
[NEW] +10 [ = ] 0 CSWTCH.22
[DEL] -12 [ = ] 0 CSWTCH.2703
[NEW] +12 [ = ] 0 CSWTCH.2711
[DEL] -24 [ = ] 0 CSWTCH.3451
[DEL] -24 [ = ] 0 CSWTCH.3452
[NEW] +24 [ = ] 0 CSWTCH.3459
[NEW] +24 [ = ] 0 CSWTCH.3460
[DEL] -10 [ = ] 0 CSWTCH.51
-50.0% -22 [ = ] 0 I2CLauncher::I2CLauncher()
-47.6% +22 [ = ] 0 [3 Others]
-2.0% -144 [ = ] 0 [Unmapped]
-0.0% -3.86Ki +0.0% +144 TOTAL
Updated: 2025-12-04T19:20:48
This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:
https://discuss.px4.io/t/px4-sitl-refuses-to-build-on-macos-intel-m-series/47858/7
On macOS, Gazebo has been unusable, and I have been continuously following document #25204. After seeing a comment stating that there was no Mac available for testing, I decided to purchase one myself—specifically, an M4 Mac mini.
Starting from the cleanest possible environment, I followed the instructions in dev_env_mac.md and completed the installation successfully. However, the x500 model does not appear in Gazebo, and instead I encounter the error shown below. Is there a known solution to this issue?
Additionally, the version of Gazebo I have installed is Gazebo Harmonic. Is it impossible to use the Gazebo Classic version on macOS at this point?
chung@Chungui-Macmini PX4-Autopilot % make px4_sitl gz_x500
[0/1] cd /Users/chung/px4/PX4-Autopilot/build/px4_sitl_def...sers/chung/px4/PX4-Autopilot/build/px4_sitl_default/bin/px
______ __ __ ___
| ___ \ \ \ / / / |
| |_/ / \ V / / /| |
| __/ / \ / /_| |
| | / /^\ \ \___ |
\_| \/ \/ |_/
px4 starting.
INFO [px4] startup script: /bin/sh etc/init.d-posix/rcS 0
INFO [init] found model autostart file as SYS_AUTOSTART=4001
INFO [param] selected parameter default file parameters.bson
INFO [param] selected parameter backup file parameters_backup.bson
SYS_AUTOCONFIG: curr: 0 -> new: 1
SYS_AUTOSTART: curr: 0 -> new: 4001
CAL_ACC0_ID: curr: 0 -> new: 1310988
CAL_GYRO0_ID: curr: 0 -> new: 1310988
CAL_ACC1_ID: curr: 0 -> new: 1310996
CAL_GYRO1_ID: curr: 0 -> new: 1310996
CAL_ACC2_ID: curr: 0 -> new: 1311004
CAL_GYRO2_ID: curr: 0 -> new: 1311004
CAL_MAG0_ID: curr: 0 -> new: 197388
CAL_MAG0_PRIO: curr: -1 -> new: 50
CAL_MAG1_ID: curr: 0 -> new: 197644
CAL_MAG1_PRIO: curr: -1 -> new: 50
SENS_BOARD_X_OFF: curr: 0.0000 -> new: 0.0000
SENS_DPRES_OFF: curr: 0.0000 -> new: 0.0010
INFO [dataman] data manager file './dataman' size is 1208528 bytes
INFO [init] Gazebo simulator 8.10.0
INFO [init] gazebo already running world: default
INFO [init] Gazebo world is ready
INFO [init] Spawning Gazebo model
INFO [gz_bridge] world: default, model: x500_0
INFO [lockstep_scheduler] setting initial absolute time to 5978000000 us
INFO [init] Setting camera to follow x500_0
INFO [init] Camera follow offset set to -2.0, -2.0, 2.0
ERROR [vehicle_magnetometer] MAG #0 failed: TIMEOUT!
ERROR [vehicle_imu] 0 - gyro 1310988 timestamp error timestamp_sample: 5957004000, previous timestamp_samplERROR [vehicle_imu] 0 - accel 1310988 timestamp error timestamp_sample: 5957004000, previous timestamp_sampERROR [vehicle_imu] 0 - gyro 1310988 timestamp error timestamp_sample: 5941692000, previous timestamp_samplERROR [vehicle_imu] 0 - accel 1310988 timestamp error timestamp_sample: 5941692000, previous timestamp_sampERROR [vehicle_imu] 0 - gyro 1310988 timestamp error timestamp_sample: 5941696000, previous timestamp_samplERROR [vehicle_imu] 0 - accel 1310988 timestamp error timestamp_sample: 5941696000, previous timestamp_sampERROR [vehicle_imu] 0 - gyro 1310988 timestamp error timestamp_sample: 5941696000, previous timestamp_samplERROR
@JeaWhanChung thank you for this. I appreciate it. However, this issue does not sound like dev env problem but SITL to me.