Normally, the icons are corrected once the script is compiled into an app (tested with pyinstaller). However, on macOS this is not perfect and there is still issues with some icons (like the showerror
icon)...
So I suggest you to manage the icons manually with the command:
root.tk.call('wm', 'iconphoto', root._w, PhotoImage(file="path/to/icon.png"))
This allows you to display a custom png image as icon, but this will also change the app icon. So I advise you to reinitialize the icon once the message is closed:
root.tk.call('wm', 'iconphoto', root._w, PhotoImage(file="path/to/icon.png"))
messagebox.showerror("Error", "Oups...")
root.tk.call('wm', 'iconphoto', root._w, PhotoImage(file="path/to/original_app_icon.png"))