htop
htop copied to clipboard
Crash on MacOS on startup
svk@iMac ~ % htop
FATAL PROGRAM ERROR DETECTED
============================
Please check at https://htop.dev/issues whether this issue has already been reported.
If no similar issue has been reported before, please create a new issue with the following information:
- Your htop version: '3.2.1'
- Your OS and kernel version (uname -a)
- Your distribution and release (lsb_release -a)
- Likely steps to reproduce (How did it happen?)
- Backtrace of the issue (see below)
Error information:
------------------
A signal 4 (Illegal instruction: 4) was received.
Setting information:
--------------------
htop_version=3.2.1;config_reader_min_version=3;fields=0 48 17 18 38 39 2 46 47 49 1;hide_kernel_threads=1;hide_userland_threads=0;shadow_other_users=0;show_thread_names=0;show_program_path=1;highlight_base_name=0;highlight_deleted_exe=1;highlight_megabytes=1;highlight_threads=1;highlight_changes=0;highlight_changes_delay_secs=5;find_comm_in_cmdline=1;strip_exe_from_cmdline=1;show_merged_command=0;header_margin=1;screen_tabs=1;detailed_cpu_time=0;cpu_count_from_one=0;show_cpu_usage=1;show_cpu_frequency=0;update_process_names=0;account_guest_in_cpu_meter=0;color_scheme=0;enable_mouse=1;delay=15;hide_function_bar=0;header_layout=two_50_50;column_meters_0=AllCPUs Memory Swap;column_meter_modes_0=1 1 1;column_meters_1=Tasks LoadAverage Uptime;column_meter_modes_1=2 2 2;tree_view=0;sort_key=46;tree_sort_key=0;sort_direction=-1;tree_sort_direction=1;tree_view_always_by_pid=0;all_branches_collapsed=0;screen:Main=PID USER PRIORITY NICE M_VIRT M_RESIDENT STATE PERCENT_CPU PERCENT_MEM TIME Command;.sort_key=PERCENT_CPU;.tree_sort_key=PID;.tree_view=0;.tree_view_always_by_pid=0;.sort_direction=-1;.tree_sort_direction=1;.all_branches_collapsed=0;
Backtrace information:
----------------------
0 htop 0x000000010d7594e6 CRT_handleSIGSEGV + 248
1 libsystem_platform.dylib 0x00007ff819587dfd _sigtramp + 29
2 ??? 0x00007ff7b27a8920 0x0 + 140701828024608
3 htop 0x000000010d760437 Panel_draw + 1147
4 htop 0x000000010d76577d ScreenManager_run + 700
5 htop 0x000000010d7578de CommandLine_run + 902
6 dyld 0x0000000118ce651e start + 462
To make the above information more practical to work with, please also provide a disassembly of your htop binary. This can usually be done by running the following command:
otool -tvV `which htop` > ~/htop.otool
Please include the generated file in your report.
Running this program with debug symbols or inside a debugger may provide further insights.
Thank you for helping to improve htop!
zsh: illegal hardware instruction htop

Please include the output from otool as well as a few words on steps to reproduce (or at least what you were trying to do when the crash happened).
The crash happens as soon as I start the program. htop.otool.zip
Okay, based on that information, the crash happens when its trying to put color/highlighting information into the text it's displaying:
https://github.com/htop-dev/htop/blob/4e6ec4a0873c56ca9de63eadf730c5bd677bd8da/Panel.c#L290
Can you have a look if there is a change when you do the following configuration changes (test one by one):
- Set
highlight_deleted_exe=1tohighlight_deleted_exe=0 - Set
find_comm_in_cmdline=1tofind_comm_in_cmdline=0 - Set
strip_exe_from_cmdline=1tostrip_exe_from_cmdline=0
@fasterit: Can you try to reproduce on your system?
The program does not even create a config file. Empty along this path /Users/svk/.config/htop/ In /etc empty too
I'm trying to tell you that I can't change the configuration. Because the configuration file of this programm, on my system simply does not exist. Could the error be due to this? I didn't compile from source, I installed from brew.
Can I get a config file from you? In those files that are on the Internet, there are no these lines that I am offered to try to change.
You can create a config file by taking the line below "Setting information" and replace ; by newline characters.
You can create a config file by taking the line below "Setting information" and replace
;by newline characters.
Ok, I tried to do so. And I tried to change the parameters as you recommended. However, nothing has changed. But now I see from the error log that the parameters are read by the application from the configuration file. But nothing has changed - still the same error. htoprc.zip
@BenBE: I cannot reproduce this on a (real, hardware) Mac and macOS 11.7.1 20G918 x86_64. Note the zsh: illegal hardware instruction htop in the original bug report and the "hackintosh" this is running on.
@fasterit thx.
@svk77 Can you give gdb (or any other debugger of your choosing) a shot and try to pinpoint exactly where things go south? The information of the process that is to be displayed when the process crashes would be good to know.
Also, you mentioned you were using the brew release version. Does this also happen if you compile the main branch from source yourself?
I got the same issue on a 15-inch MacBook Pro from 2017.
\ choris@cytosine2 /Users/admin_1
\ λ htop
FATAL PROGRAM ERROR DETECTED
============================
Please check at https://htop.dev/issues whether this issue has already been reported.
If no similar issue has been reported before, please create a new issue with the following information:
- Your htop version: '3.2.2'
- Your OS and kernel version (uname -a)
- Your distribution and release (lsb_release -a)
- Likely steps to reproduce (How did it happen?)
- Backtrace of the issue (see below)
Error information:
------------------
A signal 11 (Segmentation fault: 11) was received.
Setting information:
--------------------
htop_version=3.2.2;config_reader_min_version=3;fields=0 48 17 18 2 46 49 1;hide_kernel_threads=0;hide_userland_threads=0;hide_running_in_container=0;shadow_other_users=0;show_thread_names=0;show_program_path=0;highlight_base_name=0;highlight_deleted_exe=1;shadow_distribution_path_prefix=0;highlight_megabytes=1;highlight_threads=1;highlight_changes=0;highlight_changes_delay_secs=5;find_comm_in_cmdline=1;strip_exe_from_cmdline=1;show_merged_command=0;header_margin=1;screen_tabs=1;detailed_cpu_time=0;cpu_count_from_one=0;show_cpu_usage=0;show_cpu_frequency=0;update_process_names=0;account_guest_in_cpu_meter=0;color_scheme=0;enable_mouse=1;delay=50;hide_function_bar=0;header_layout=two_33_67;column_meters_0=System Hostname DateTime Uptime LoadAverage;column_meter_modes_0=2 2 2 2 2;column_meters_1=AllCPUs8 CPU Memory Swap Battery;column_meter_modes_1=1 1 1 1 1;tree_view=0;sort_key=46;tree_sort_key=0;sort_direction=-1;tree_sort_direction=1;tree_view_always_by_pid=1;all_branches_collapsed=0;screen:CPU=PID USER PRIORITY NICE STATE PERCENT_CPU TIME Command;.sort_key=PERCENT_CPU;.tree_sort_key=PID;.tree_view=0;.tree_view_always_by_pid=1;.sort_direction=-1;.tree_sort_direction=1;.all_branches_collapsed=0;screen:Memory=PID M_VIRT M_RESIDENT PERCENT_MEM Command;.sort_key=M_RESIDENT;.tree_sort_key=PID;.tree_view=0;.tree_view_always_by_pid=0;.sort_direction=-1;.tree_sort_direction=1;.all_branches_collapsed=0;screen:Info=PID PPID SESSION TTY STATE Command;.sort_key=PID;.tree_sort_key=PID;.tree_view=1;.tree_view_always_by_pid=1;.sort_direction=1;.tree_sort_direction=1;.all_branches_collapsed=0;
Backtrace information:
----------------------
0 htop 0x00000001016df088 CRT_handleSIGSEGV + 248
1 libsystem_platform.dylib 0x00007ff809c5f5ed _sigtramp + 29
2 ??? 0x0000000000000000 0x0 + 0
3 htop 0x00000001016f4dce Platform_getBattery + 318
4 htop 0x00000001016db7d7 BatteryMeter_updateValues + 39
5 htop 0x00000001016e1dde Header_updateData + 94
6 htop 0x00000001016ee9dc ScreenManager_run + 460
7 htop 0x00000001016dcf3a CommandLine_run + 1962
8 dyld 0x00007ff8098d841f start + 1903
To make the above information more practical to work with, please also provide a disassembly of your htop binary. This can usually be done by running the following command:
otool -tvV `which htop` > ~/htop.otool
Please include the generated file in your report.
Running this program with debug symbols or inside a debugger may provide further insights.
Thank you for helping to improve htop!
zsh: segmentation fault htop
Installed using the Nix package manager.
I remember recently using Migration Assistant and transferred all the configuration files, so there might be configuration weirdness, but a well-behaved program shouldn't segfault because of that. In addition, my home directory is not my username.
@chorismate You crash seems to have a different cause from the one in the first post. In your case the cause is caused by reading the battery information. To confirm this you can remove the Battery meter from your configuration (by editing htoprc manually. If you can find your way around gdb or another debugger, please take a look at the value of power_type returned around line 500 in Platform_getBattery.
CFStringRef power_type = CFDictionaryGetValue(power_source, CFSTR(kIOPSTransportTypeKey)); // <-- That return value here
if (kCFCompareEqualTo != CFStringCompare(power_type, CFSTR(kIOPSInternalType), 0)) // Crash happens here inside CFStringCompare
continue;
@svk77 I did a small fixup in the rendering code that might resolve your issue. Would be nice if you could test commit b810678 (from the main branch) and checking if this resolves the issue. If the issue persists, please check in a debugger, what the contents of the local variable item were when the crash occurs.
@BenBE Yes, it fixes the issue. (Thanks!)
I'm not clear on how to use a debugger though; I don't have a lot of time to look into it.
I got same problem as @latticecrystalline, installed via Nix on MacOS (12.6.9), Macbook 2015, x86. Tried to run the built but got error on not loaded libncursesw. Will try tomorrow again. Looks like setting LD_LIBRARY_PATH not works?
dyld[35887]: Library not loaded: '@rpath/libncursesw.6.dylib'
Referenced from: '/usr/local/bin/htop'
Reason: tried: '/usr/local/lib/libncursesw.6.dylib' (no such file), '/usr/lib/libncursesw.6.dylib' (no such file)