Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shellcheck not found on M1 Mac #244

Closed
bhrutledge opened this issue Jun 12, 2021 · 12 comments · Fixed by #246
Closed

shellcheck not found on M1 Mac #244

bhrutledge opened this issue Jun 12, 2021 · 12 comments · Fixed by #246
Labels

Comments

@bhrutledge
Copy link

I'm getting this error when I open a shell script:

The shellcheck program was not found (not installed?). Use the 'shellcheck.executablePath' setting to configure the location of 'shellcheck'

I have shellcheck installed via Homebrew:

% which shellcheck
/opt/homebrew/bin/shellcheck

Poking around a bit, I found what looks like the relevant source:

https://github.com/timonwong/vscode-shellcheck/blob/3a803d31912b863985405da042339db98fda0c56/src/linter.ts#L136

https://github.com/timonwong/vscode-shellcheck/blob/3a803d31912b863985405da042339db98fda0c56/src/linter.ts#L199

From that, I can see that there isn't a binary for the M1 architecture:

% tree ~/.vscode/extensions/timonwong.shellcheck-0.14.1/binaries
/Users/bhrutledge/.vscode/extensions/timonwong.shellcheck-0.14.1/binaries
├── darwin
│   └── x64
│       └── shellcheck
├── linux
│   ├── arm
│   │   └── shellcheck
│   ├── arm64
│   │   └── shellcheck
│   └── x64
│       └── shellcheck
└── win32
    └── x32
        └── shellcheck.exe

Still, I would have expected the default of shellcheck to work. I thought it might be related to my runtime PATH not being set properly, but looking at process.env.PATH from the VS Code Developer Tools shows that it includes /opt/homebrew/bin.

Of course, this is a minor annoyance, because I can set it manually, but it'd be nice if it just worked. 😄

@felipecrs
Copy link
Collaborator

felipecrs commented Jun 12, 2021

Did try to add shellcheck to shellcheck.executablePath (this is how you instruct the extension to use the shellcheck which is in your PATH)? The default is to use the builtin ones. Once the ShellCheck project starts publishing releases for Apple M1, we can include it in the extension as well.

@bhrutledge
Copy link
Author

Yep, setting "shellcheck.executablePath": "/opt/homebrew/bin/shellcheck" works as expected. I just thought this extension might discover it automatically if it was in my $PATH, since it looks like that's what the code is intended to do.

For reference, here's the issue for an M1 build of shellcheck: koalaman/shellcheck#2109. As I noted in a comment just now, it's installable natively with Homebrew (as of a couple days ago), so hopefully the shellcheck folks will release an official build.

@felipecrs
Copy link
Collaborator

Did you try "shellcheck.executablePath": "shellcheck"?

@bhrutledge
Copy link
Author

bhrutledge commented Jun 12, 2021

Ah, yes, that works too. Thanks!

@felipecrs
Copy link
Collaborator

felipecrs commented Jun 12, 2021

But your issue is still valid, the extension should properly find it automatically when the bundled one is not available. I'm going to check.

felipecrs added a commit that referenced this issue Jun 12, 2021
When bundled binaries are not available.

Fixes: #244
felipecrs added a commit that referenced this issue Jun 12, 2021
…le (#246)

When bundled binaries are not available.

Fixes: #244
timonwong pushed a commit that referenced this issue Jun 12, 2021
### [0.14.2](v0.14.1...v0.14.2) (2021-06-12)

### Bug Fixes

* not loading shellcheck from PATH when the bundled is not available ([#246](#246)) ([7a31f98](7a31f98)), closes [#244](#244)

### Dependencies

* **deps:** upgrade dependencies ([#245](#245)) ([1f189eb](1f189eb))
@github-actions
Copy link

🎉 This issue has been resolved in version 0.14.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@felipecrs
Copy link
Collaborator

@bhrutledge when possible please test this new version to confirm it fixes your issue.

@bhrutledge
Copy link
Author

Yep! Thank you!

@lu-yanda
Copy link

still met this issue of shellcheck 0.9, how to set "shellcheck.executablePath": "shellcheck", where should i put

@lu-yanda
Copy link

image

@felipecrs
Copy link
Collaborator

@lu-yanda what's this hook, man? Seems like the extension is trying to use this hook (check your vscode settings), and the hook can't find shellcheck installed.

@Morriz
Copy link

Morriz commented Jan 27, 2024

this is still an issue on Sonoma on apple silicon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants