First an MWE is as follows.








As you see, I use zhmakeindex to make Chinese index with imakeidx as above. Before compiling the tex file, I download the bin file from the link since when I input uname -a in the terminal on my Macbook Pro it produces the information as follows

Darwin Kernel Version 18.7.0: Tue Jun 22 19:37:08 PDT 2021;
root:xnu-4903.278.70~1/RELEASE_X86_64 x86_64

and then add the bin file into the following folder where the makeindex locates


I compile the tex file by XeLaTeX with -shell-escape option, but it says

sh: /Library/TeX/texbin/zhmakeindex: Permission denied

and produces the index page on which the index entries are in occurrence order but not in Chinese pinyin alphabet order.

So what's wrong or what I missed? Not install Go programming language on my Macbook, or something else?

  • Did you assign executable permission?
    – egreg
    Commented May 31, 2022 at 6:16
  • @egreg No. And how to do that?
    – M. Logic
    Commented May 31, 2022 at 6:17
  • 1
    sudo chmod a+x /Library/TeX/texbin/zhmakeindex
    – egreg
    Commented May 31, 2022 at 6:25
  • @egreg According the README of zhmakeindex, the Go language is needed, so should I install it before assigning executable permission?
    – M. Logic
    Commented May 31, 2022 at 6:28
  • 1
    You need Go to compile the program. Just set the permission and remember to call pdflatex -shell-escape, because zhmakeindex is not in the list of programs allowed in restricted shell-escape.
    – egreg
    Commented May 31, 2022 at 7:01

1 Answer 1


The message means that you didn't apply “execute” permissions to the binary file.

From your terminal issue

sudo chmod a+x /Library/TeX/texbin/zhmakeindex

and you'll be OK, so long as you call xelatex (or other engine) with the -shell-escape option (because zhmakeindex is not in the allowed list for the restricted shell-escape).

Quite likely, macOS will reject the first attempt to run the program. Do as usual when you trust the source: Security settings panel in System Preferences, click “Allow anyway” and rerun, clicking “Open” at the next pop-up window.
  • After install the latest Go programming language and issue the codes as above, it works! Thanks very much!
    – M. Logic
    Commented May 31, 2022 at 8:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .