How do I format a big disk (4TB) for use in both macOS and a Raspberry Pi? I need to setup a big hard disk (4TB) so that I'll be able to use it in both macOS and in a Raspberry Pi.

Up to now all my attempts failed - at the moment I have formatted it so that it uses GPT, type "linux filesystem", and all the 4TB are recognized - linux recognizes it but not the Mac

The solution proposed in Trying to format USB (using Linux/fdisk) so it shows up on my Mac does not work since it suggests the MSDOS type, which doesn't work for big disks.

Is there a recommended way to solve this?
For the partition table, you'll want to use the "GUID Partition Table" (called GUID Partition Map in macOS Disk Utility, and GPT on Linux/Raspberry Pi). The MBR partition table you've have been suggested indeed does not work for partitions larger than 2 TB.

For the file system itself, you'll want to use ExFAT. It is a relatively simple file system understood by both macOS and Linux/Raspberry Pi without many of the size limitations of earlier MS-DOS style filesystems such as FAT16 and FAT32.