After a day of trial, I have finally come up with a way to install shiny server on macOS. Previously, I have to use docker to spawn a shiny container to run a shiny server which is less ideal because package dependency management is very difficult.
The installation requires homebrew. If you are not using homebrew to manage your system software, I strongly recommend you to switch to it.
Here is a PR of a homebrew formula to brewsci. Until that is merged, the formula could be installed by
brew install https://raw.githubusercontent.com/randy3k/homebrew-base/shiny/Formula/shiny-server.rb
If you are reading this post in the future and if the formula is merged, one could use the following to install shiny-server
brew tap brewsci/base brew install shiny-server
Once the shiny-server formula has been installed, you will need to configure a few things in the file
run_asuser: it is most likely your current username, or you could also create the admin user
shinyand run the server on behalf of themself. You also want to make sure that the run_as user has reading and writing rights to the shiny app directory.
The shiny app directory: just point it to your shiny app directory. I don't recommend changing it because macOS 10.14+ is very picky about user permissions and security.
That's pretty much it is.
shiny-server will run the server.
Finally, you might install Nginx and route your public IP to the shiny-server. There are a lot of examples on the internet on how to do it.