I have not done this for a few years, but here goes.
From what I understand and how I did it previously you need to install “homebrew”, this is essentially a package manager for Mac. It is very similar in functionality to Linux package managers.
A package manager should look for all other libraries and support files that are required to make the application (package) run correctly on your system and install them, if required.
Here is a page you can follow that will allow you to install Ghostscript.
http://macappstore.org/ghostscript/
The reason I gave you the pre-amble is because I wanted to explain what the commands are doing.
The first command installs the homebrew package manager, once that is in place the final command “brew install ghostscript” will do as it sounds and install the ghostscript package.
I just tested this on my Mac and after the package manager was installed a reboot was required. After the reboot any attempt to run the final command (brew install ghostscript) was met with a requirement to update my command line tools via the app store. I opened the app store and it offered the update for me to install. When this was complete the final command completed successfully.
As I said, it has been a few years since I did this, but everything worked okay for me.
I hope this helps.