Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pandoc: xelatex: createProcess: posix_spawnp: illegal operation (Inappropriate ioctl for device) #10

Closed
apotenza92 opened this issue Jun 12, 2022 · 12 comments

Comments

@apotenza92
Copy link

Hi, I'm on macOS and receive this error. I'm using Pandoc and MacTex, both are installed and on my path but I still recieve this error.

Screen Shot 2022-06-12 at 1 42 29 pm

I use the exact same command arguments on my PC using Pandoc and MikTEX and it works perfectly fine.

Is there something unique I need to do on macOS to ensure the installation of pandoc or Tex works?

@apotenza92
Copy link
Author

Here are some terminal outputs to show you my install and the fact that everything is in my PATH. I've tried using both homebrew and manually installing pandoc and tex.

which xelatex
/Library/TeX/texbin/xelatex

which pandoc
/usr/local/bin/pandoc

echo "${PATH//:/\n}"
/opt/homebrew/bin
/opt/homebrew/sbin
/usr/local/bin
/System/Cryptexes/App/usr/bin
/usr/bin
/bin
/usr/sbin
/sbin
/Library/TeX/texbin

@mokeyish
Copy link
Owner

@apotenza92 Hi, did you run the command on terminal directly success? I have never use MikTEX,maybe should custom your own command.

@apotenza92
Copy link
Author

apotenza92 commented Jun 12, 2022

I made a custom command that works perfectly well on Windows:
pandoc --pdf-engine lualatex --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -o "${outputDir}/${currentFileName}.pdf" "${currentPath}"

That exact command doesn't work on Mac and you end up with the same error:
pandoc: lualatex: createProcess: posix_spawnp: illegal operation (Inappropriate ioctl for device)

If I run the command below in a Mac terminal it works perfectly:
pandoc --pdf-engine lualatex -o "filename.pdf" "filename.md"

@apotenza92
Copy link
Author

Sorry didn't mean to close.

@apotenza92 apotenza92 reopened this Jun 12, 2022
@mokeyish
Copy link
Owner

@apotenza92 you look jgm/pandoc#7570

@mokeyish
Copy link
Owner

Haven't seen this before, but I've seen a slightly different issue on M1 macs solved by specifying the full path to the pdflatex program.

pandoc -o my.pdf --pdf-engine=/Library/TeX/texbin/pdflatex

See pandoc FAQs.

Originally posted by @jgm in jgm/pandoc#7570 (comment)

@mokeyish
Copy link
Owner

mokeyish commented Jun 13, 2022

Here are some terminal outputs to show you my install and the fact that everything is in my PATH. I've tried using both homebrew and manually installing pandoc and tex.

which xelatex /Library/TeX/texbin/xelatex

which pandoc /usr/local/bin/pandoc

echo "${PATH//:/\n}" /opt/homebrew/bin /opt/homebrew/sbin /usr/local/bin /System/Cryptexes/App/usr/bin /usr/bin /bin /usr/sbin /sbin /Library/TeX/texbin

let envPath = ct.remote.process.env['PATH'];
const brewBin = '/usr/local/bin';
if (!envPath.includes(brewBin)) {
envPath = `${brewBin}:${envPath}`;
ct.remote.process.env['PATH'] = envPath;

You can specify the full path of lualatex, since there aren't extra paths in PATH, So I add brewBin manully in above code.

or make a symbolic of xelatex to /usr/local/bin

ln -s `which xelatex` /usr/local/bin/

@mokeyish
Copy link
Owner

mokeyish commented Jul 2, 2022

@apotenza92 Hi,Does the above solution work? if it works, I will add /Library/TeX/texbin/ to the PATH

@rodzam
Copy link

rodzam commented Aug 2, 2022

if it works, I will add /Library/TeX/texbin/ to the PATH

@mokeyish Could you please add that PATH modification?

I'm on an M1 Mac and had a similar error message when I did not specify the full path to xelatex (in my case). When I manually supplied the full path in the extra argument (--pdf-engine="/Library/TeX/texbin/xelatex"), it was seemingly able to find xelatex. However, I would then get an error that extractbb could not be found. Curiously, when I executed the exact same command in my terminal, it worked.

Creating a symlink to extractbb in /usr/local/bin per your suggestion did the trick, which suggests to me that /Library/TeX/texbin is not being evaluated without your proposed fix and that specifying the full path in the argument is an insufficient solution for some use cases.

Thanks for your work on this excellent plugin!

@mokeyish
Copy link
Owner

mokeyish commented Aug 2, 2022

Great, that's it's OK to add environment variables. I'll add it later this week. Thank you for trying the above.

BTW: I'm writing another plugin Code emitter
I hope it will be also useful to you.

@mokeyish
Copy link
Owner

mokeyish commented Aug 3, 2022

@rodzam Hi, rodzam , You can try the latest version. I have added it to the PATH

@rodzam
Copy link

rodzam commented Aug 3, 2022

The new version works great! Obsidian no longer complains about the missing extractbb executable when I specify the full path to xelatex in the --pdf-engine argument. Furthermore, it is able to find xelatex without my specifying the full path. Thus, the program now behaves as expected.

I expect this would fix the original "illegal operation" issue that @apotenza92 experienced, too.

Thanks for the quick fix!

As a future To Do, I wonder if it would be possible to add a setting for manually specifying a new PATH variable, for people who use non-standard TeX installations. I think that might help with future-proofing things. That said, the implemented fix should solve things for the vast majority of Mac users, and the symlink solution would still be a possibility for those edge cases.

@mokeyish mokeyish closed this as completed Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants