Unable to run latexindent macOS Monterey 12.0.1
Asked Answered
I

2

5

I need to be able to run the command latexindent but I get this error every time:

Unknown PerlIO layer 'encoding' at /usr/local/texlive/2021/texmf-dist/scripts/latexindent/LatexIndent/Document.pm line 21.
Unknown PerlIO layer "encoding" at /opt/homebrew/Cellar/perl/5.34.0/lib/perl5/5.34.0/open.pm line 126.
Unknown PerlIO layer "encoding" at /opt/homebrew/Cellar/perl/5.34.0/lib/perl5/5.34.0/open.pm line 134.
Unknown PerlIO layer "encoding" at /opt/homebrew/Cellar/perl/5.34.0/lib/perl5/5.34.0/open.pm line 135.
Attempt to reload PerlIO/encoding.pm aborted.
Compilation failed in require at /usr/local/texlive/2021/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm line 20.
BEGIN failed--compilation aborted at /usr/local/texlive/2021/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm line 20.
Compilation failed in require at /usr/local/texlive/2021/texmf-dist/scripts/latexindent/LatexIndent/Document.pm line 29.
BEGIN failed--compilation aborted at /usr/local/texlive/2021/texmf-dist/scripts/latexindent/LatexIndent/Document.pm line 29.
Compilation failed in require at /usr/local/texlive/2021/bin/universal-darwin/latexindent line 27.
BEGIN failed--compilation aborted at /usr/local/texlive/2021/bin/universal-darwin/latexindent line 27.

I installed MacTeX with Homebrew through this command brew install --cask mactex. When I type the command which latexindent it gives this /usr/local/texlive/2021/bin/universal-darwin/latexindent. I have Perl v5.34.0 and it is here /opt/homebrew/bin/perl.

How do I set the encoding for PerlIO?

Insociable answered 13/12, 2021 at 22:33 Comment(0)
F
9

I solved by installing latexindent via homebrew. The command is brew install latexindent. I'm on MacOS Monterey 12.4

EDIT: Tested recently on macOS Sonoma 14.4 and it is still working!

Freshwater answered 22/6, 2022 at 7:56 Comment(0)
I
2

Based on this question, I found a solution to my problem like this :

  1. I deleted : ~/perl5, ~/.cpan, ~/.cpanm;
  2. I restarted my computer;
  3. Then I installed Log::Log4perl with the command cpan install Log::Log4perl. There it asked me if I wanted to choose automatic or manual configuration mode. I chose the automatic mode;
  4. Then I installed other modules based on this post: SQL::Statement, Text::CSV_XS,DBD::CSV, Log::Dispatch::File, cpan install YAML::Tiny, File::HomeDir, Unicode::GCString, Mac::SystemDirectory;

And finally the command latexindent --version gives me the version 3.9.1, 2021-03-21 and it works.

Insociable answered 18/12, 2021 at 23:1 Comment(1)
Log4perl no longer required :)Supersedure

© 2022 - 2024 — McMap. All rights reserved.