mac won't start after "sudo chown -R $(whoami) $(brew --prefix)/*" command I tried to install a program and it alwaysed lacked permission on /usr/local.
I tried sudo chown -R $USER /usr/local but then found out that doesn't work anymore with High Sierra.
So I tried sudo chown -R $(whoami) $(brew --prefix)/*  . That brought an awful lot of "Operation not permitted" in the terminal.

After that I wanted to install again with sudo. Then an error message showed sth like "sudoers uid is 501 should be 0" (cant exactly remember it)

Then I tried to restart the mac, but it never did... Just black screen. I heard the starting sound once or twice, but it never booted again or showed anything on the screen. Anyone any idea what happend and how to fix it?
It sounds like you mistyped the command or had problems with your brew command, making the chown apply to not only /usr/local but rather / - i.e. the whole system. The command you have written is actually relatively dangerous, as you're relying on "brew --prefix" to output the right thing.

In this case your command changed the owner of system files, such as the /etc/sudoers file. This is why the system won't boot anymore.

The good news is that you should be able to boot the Mac in Recovery Mode by holding down Cmd and R while booting. From there you should be able to select that you want to reinstall macOS on your computer. This should allow you to overwrite those system files and ensure that the system is good to boot, while keeping your own files intact. If you have done any changes to the system files, you'll loose those ofcourse.