You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But, the gem executable can't be executed by /bin/sh or /bin/bash (or, at least I think that's the issue):
$ /bin/sh -c 'bin/rspec --version'
bin/rspec: line 9: require: command not found
bin/rspec: line 11: Gem.use_gemdeps: command not found
bin/rspec: line 13: version: command not found
bin/rspec: line 15: str: command not found
bin/rspec: line 17: syntax error near unexpected token `('bin/rspec: line 17: ` str = str.b[/\A_(.*)_\z/, 1]'$ /bin/bash -c 'bin/rspec --version'(same thing)$ bin/ruby -e 'system "bin/rspec --version"'(same thing)
It does work if I specify the interpreter explicitly:
I did a little more digging here. Turns out, a script cannot be used as an interpreter in a shebang line on macOS.
Here's an explanation and possible solution for this issue: NixOS/nixpkgs#93757
rzane
changed the title
gem executables don't appear to be compatible with /bin/sh
gem executables can't be executed by /bin/sh or /bin/bash on macOS
Dec 30, 2024
Environment
OS: macOS 14.7.2
ARCH: arm64
SHELL: /bin/zsh
Reproduction
I'm installing Traveling Ruby like this:
$ curl -L https://github.com/YOU54F/traveling-ruby/releases/download/rel-20241122/traveling-ruby-20241122-3.2.6-osx-arm64-full.tar.gz | tar xzf -
I can install and execute a command line utility:
But, the gem executable can't be executed by
/bin/sh
or/bin/bash
(or, at least I think that's the issue):It does work if I specify the interpreter explicitly:
$ sh -c 'bin/ruby bin/rspec --version' RSpec 3.13 - rspec-core 3.13.2 - rspec-expectations 3.13.3 - rspec-mocks 3.13.2 - rspec-support 3.13.2
The text was updated successfully, but these errors were encountered: