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

Running any command on MacOS fails with an error "operation not permitted" #157

Closed
icewind opened this issue Nov 19, 2020 · 0 comments · Fixed by #167
Closed

Running any command on MacOS fails with an error "operation not permitted" #157

icewind opened this issue Nov 19, 2020 · 0 comments · Fixed by #167

Comments

@icewind
Copy link

icewind commented Nov 19, 2020

Hi.
I can't execute any of the command using lefthook. I've tried several different commands(such as go fmt, go vet, gocritic) and the error message is always the same.

EXECUTE > lint
fork/exec /bin/sh: operation not permitted

Configuration file is pretty simple

pre-commit:
  commands:
    lint:
      glob: "*.go"
      run: "golint {staged_files}"
      exclude: vendor/*

All permissions on executables seems to be fine.

-rwxr-xr-x  1 northicewind  mbp  5211280 Nov 19 09:10 .direnv/go/bin/golint

In this particular case, I've used lefthook installed into local environment. Installing it in the global env ~/go makes no difference.
Golang is working, tools are working, golint is also works fine if invoked directly. I've checked MacOS attributes and none of the files in the project have quarantine attribute.

> xargs -l .direnv/go/bin/golint
> 

Operation system is MacOS 10.15.4. Golang version go version go1.15.4 darwin/amd64

Meanwhile custom scripts with bash runner works fine

pre-commit:
  scripts:
    "check_forbidden_files.sh":
      runner: bash

The script gets executed with no issues.
Could you please point me what is wrong?
Thanks.

UPDATE
Turns out, that lefthook is broken only if installed using go get. It appears to work fine if installed using homebrew.

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

Successfully merging a pull request may close this issue.

1 participant