A few months back I wrote a post on how to compile and build an installer for the shellcheck binary for macOS.
Just a few weeks later, the shellcheck project added a download for a pre-compiled binary for macOS. You can now download the binary with this link:
Ironically, macOS can unarchive xz archives when you double click them in the Finder, but there is no command line tool on macOS to unarchive them. In the previous post, I ran into the same problem, and there you can find instructions on how to install the
xztools on macOS.
After downloading and un-archiving, you can manually move the
shellcheck binary to a suitable directory. The standard location is
For manual installations, this is it! Much simpler than before. Thank you!
Note: if you want the man page as well, you still need to build it with pandoc from the source.
Build a pkg for managed deployment
If you are a MacAdmin and want to distribute
shellcheck with your management system, you will need to build an installer package (pkg).
Instead of copying the binary to
/usr/local/bin, place it in a
payload folder in a project folder. Then build the pkg with
% mkdir -p ShellcheckPkg/payload % cp ~/Downloads/shellcheck-latest/shellcheck ShellcheckPkg/payload % pkgbuild --root ShellcheckPkg/payload --identifier com.example.shellcheck --version 0.7.0 --install-location /usr/local/bin shellcheck-0.7.0.pkg
0.7.0 with the actual version number.