> When I compile a lilypond file I get the following error: [...]
This is due to an upgrade of homebrew to ghostscript 10.02.1, which removed a function used by LilyPond. https://gitlab.com/lilypond/lilypond/-/issues/6675 We already have a fix, but until this is out I suggest to use the binary we provide, and that you can download from https://lilypond.org/download.html