3

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?

Daniel Schreurs
  • 186
  • 1
  • 10

2 Answers2

8

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

giopollo
  • 81
  • 1
  • 4
1

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.

Daniel Schreurs
  • 186
  • 1
  • 10