ryanmjacobs / c

Compile and execute C "scripts" in one go!
MIT License
2.09k stars 178 forks source link

Shebang don't work, on MacOS 12.6 with FishShell 3.5.1 #66

Open leolovenet opened 2 years ago

leolovenet commented 2 years ago

When I use Shebang as described in README.md, I get an error. Xnip2022-09-23_15-44-53

This seems to be a compatibility issue with FishShell at the moment, as it works fine with Bash and Zsh.

I checked the source code of FishShell and I think the problem is here https://github.com/fish-shell/fish-shell/blob/master/src/exec.cpp#L177

Currently still looking for a solution

leolovenet commented 2 years ago

I found this. https://stackoverflow.com/a/9988385/2138221

Looks like Mac OS X requires interpreter to be binary, not another script.

I changed Shebang to #!/usr/bin/env /usr/local/bin/c temporarily solved the problem

Xnip2022-09-23_15-56-07

I hope this solution can help other people like me

sebastiancarlos commented 10 months ago

@leolovenet by the way, if you use /usr/bin/env in the shebang, you don't need to explicitly type the full path to /usr/local/bin/c.

If /usr/local/bin is in your PATH (and it probably is), you can use this shorter shebang:

#!/usr/bin/env c