Skip to contentKyle Macquarrie

Install glslang using Homebrew

I’ve been going through Bruno Simon’s great Three.js Journey course lately. There’s a section on shaders, where Bruno recommends the GLSL Linter extension for VS Code, which requires the OpenGL Reference Compiler to be installed and the path to be set in the extension settings. The video he references uses a convoluted manual process, but if you’re able to use Homebrew it becomes much simpler. I’ve tested this on Ubuntu running in WSL, but it should be the same for Mac OS and other Linux flavours.

Install using Homebrew:

$ brew install glslang

Check it’s installed and in your PATH - note the capital V in the command name

$ glslangValidator -v

Get the path to the installed binary

$ which glslangValidator

Drop that path into the Glsl-linter: Validator Path setting in VS Code and the extension should pick it up correctly — you may need to reload VS Code.

If you’re following Bruno’s naming scheme (e.g. fragment.glsl and vertex.glsl), you may run into this issue where it can’t work out which shader type type to use to validate. You can either rename the shader files (e.g. fragment.frag and vertex.vert should work out the box) or add fragment.glsl and vertex.glsl to the Glsl-linter: File Extensions setting.

"glsl-linter.fileExtensions": {
  "fragment.glsl": "frag",
  "vertex.glsl": "vert"
}

← All articles