sbarex / SourceCodeSyntaxHighlight

Quick Look extension for highlight source code files on macOS 10.15 and later.
GNU General Public License v3.0
2.88k stars 72 forks source link

syntax_highlight_cli doesn't work via brew #249

Open maxx27 opened 1 year ago

maxx27 commented 1 year ago

When I installed syntax-highlight via brew, it creates symlink:

$ ls -l /opt/homebrew/bin/syntax_highlight_cli
lrwxr-xr-x@ 1 maxim  admin  74 May 22 16:01 /opt/homebrew/bin/syntax_highlight_cli ->
  /Applications/Syntax Highlight.app/Contents/Resources/syntax_highlight_cli

When I want to convert any file:

$ mkdir ~/Temp
$ cd ~/Temp
$ echo Hello > test.txt
$ syntax_highlight_cli -o test.html test.txt
Error processing /Users/m.suslov/Temp/test.txt: Syntax Highlight: colorize.sh failed with exit code 127. Command was ('/Users/Contents/Resources/highlight/colorize.sh' '/Users/m.suslov/Temp/test.txt').

command: '/Users/Contents/Resources/highlight/colorize.sh' '/Users/m.suslov/Temp/test.txt'
exitCode: 127

Here we can see that colorize.sh is invoked with incorrect path

The same if I invoke with full path to brew symlink:

/opt/homebrew/bin/syntax_highlight_cli -o test.html test.txt

But when I invoke with fullpath to application, it works:

$ '/Applications/Syntax Highlight.app/Contents/Resources/syntax_highlight_cli' -o test.html test.txt

Could please fix calling colorize.sh with right path?

P.S. Version of syntax-highlight 2.1.19

nborelli commented 4 months ago

As a temporary fix for this problem, you can issue the following command to change the symlink to the correct path:

ln -sf "/Applications/Syntax Highlight.app/Contents/Resources/syntax_highlight_cli" "/opt/homebrew/bin/syntax_highlight_cli"
W-quan commented 2 months ago

Me too. And i had try install not by brew, still not work.