I tried setting up a build to read html code using google on Sublime Text.
I used the following code for the build:
{
"cmd":["/Applications/Google Chrome.app","$file"]
}
However, when I press Cmd + B i have the following error:
[Errno 13] Permission denied: '/Applications/Google Chrome.app'
Any idea on how to allow sublime text to have permission ?
Thanks for your help
On MacOS, Applications are bundled in app folders, but you can't execute them directly from the command line because as far as the shell is concerned, they're folders.
Hence, you get a permission denied error because you're not allowed to run a folder.
To do what you want, you want to use the open
command that is part of MacOS. That tells the OS to find the appropriate application for the type of file and use that to open it.
For your build, you want something like:
{
"shell_cmd": "open \"\" \"$file\""
}
For google chrome use below command
{
"shell_cmd": "open \"/Applications/Google Chrome.app\" \"$file\""
}
Optionally, you can also include the line:
"selector": "text.html",
in the body of the build; that gives Sublime the hint that it applies to HTML files, so that setting the build system in Tools > Build System
to Automatic
will know that this build applies while the current file is an HTML file.