MacTeX Ghostscript permission issue on macOS 10.15 Catalina

mactex / mactex-no-gui (2019.0508) installed on macOS 10.15 from brew cask has the following issue while compiling with XeLaTeX when ps is involved. And this does not occur when texlive and Ghostscript is installed by mactex instead of by brew cask.

xdvipdfmx:warning: Filtering file via command -->rungs -q -dNOPAUSE -dBATCH -dEPSCrop -sPAPERSIZE=a0 -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dAutoRotatePages=/None -sOutputFile='/tmp/dvipdfmx.7871Fw' '/tmp/dvipdfmx.FYlY9K' -c quit<-- failed.
xdvipdfmx:warning: Image format conversion for PSTricks failed.
xdvipdfmx:warning: Interpreting special command pst: (ps:) failed.
xdvipdfmx:warning: >> at page="12" position="(245.198, 203.093)" (in PDF)
xdvipdfmx:warning: >> xxx "pst:  tx@Dict begin STP newpath 0.8 SLW 0  setgray   0.0 0.0 0."
Error: /invalidfileaccess in --run--
Operand stack:
   (/usr/local/texlive/2019/texmf-dist/dvips/pstricks/pstricks.pro)   (r)
Execution stack:
   %interp_exit   .runexec2   --nostringval--   run   --nostringval--   2   %stopped_push   --nostringval--   run   run   false   1   %stopped_push   1974   1   3   %oparray_pop   1973   1   3   %oparray_pop   1961   1   3   %oparray_pop   1817   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   run   --nostringval--   2   %stopped_push   --nostringval--   1974   1   3   %oparray_pop   run
Dictionary stack:
   --dict:735/1123(ro)(G)--   --dict:0/20(G)--   --dict:75/200(L)--
Current allocation mode is local
Last OS error: Permission denied
Current file position is 69
GPL Ghostscript 9.50: Unrecoverable error, exit code 1

Here is a sample of .tex file.

\documentclass{article}

\usepackage{pstricks}
\usepackage{pstcol}
\usepackage{egameps}
\begin{document}

\begin{figure}[htb]
\hspace*{\fill}
\begin{egame}(600,280)
%
% put the initial branch at (300,240), with (x,y) direction % (2,1), and horizontal length 200
\putbranch(300,240)(2,1){200}
%
% give the branch two actions, label it for player 1, % and label the actions $L$ and $R$
\iib{1}{$L$}{$R$}
%
% put a branch at (100,140), with (x,y) direction
% (1,1) and horizontal length 100
\putbranch(100,140)(1,1){100}
%
% give the branch two actions, omit a player label,
% label the actions $a$ and $b$, and assign the payoffs
% $1,0$ and $2,3$ to these actions
\iib{}{$a$}{$b$}[$1,0$][$2,3$]
%
% put a branch at (500,140), with (x,y) direction (1,1)
% and horizontal length 100
\putbranch(500,140)(1,1){100} %
% give the branch two actions, omit a player label,
% label the actions $c$ and $d$, and assign the payoffs
% $0,1$ and $-1,0$ to these actions
\iib{}{$c$}{$d$}[$0,1$][$-1,0$]
%
% draw an information set between the nodes at (100,140) % and (500,140)
\infoset(100,140){400}{2}
%
\end{egame}
\hspace*{\fill}
\caption[]{An extensive game}\label{f:one}
\end{figure}

\end{document}

I’m experiencing a similar issue with Ghostscript permissions (also on catalina), but I am running into it when running foomatic-rip. I’ve installed ghostscript using homebrew today, but I haven’t yet tried other install approaches. I can reproduce the error with the below command:

$ /usr/local/bin/gs -dNODISPLAY -q -c '/pdffile (/private/var/spool/cups/tmp/foomatic-zEFQFT) (r) file def pdfdict begin pdffile pdfopen begin (PageCount: ) print pdfpagecount == flush currentdict pdfclose end end quit'
Error: /invalidfileaccess in --file--
Operand stack:
   pdffile   (/private/var/spool/cups/tmp/foomatic-zEFQFT)   (r)
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:724/1123(ro)(G)--   --dict:0/20(G)--   --dict:75/200(L)--
Current allocation mode is local
Last OS error: Permission denied
GPL Ghostscript 9.50: Unrecoverable error, exit code 1

I tried building ghostscript from source, and it seems that it’s installed successfully, but I’m still running into this issue. Maybe it’s an issue with GS 9.50?