I manage my versions of Ruby with
asdf.
I have a test script.
#!/usr/bin/env ruby
puts RUBY_VERSION
puts ENV['PATH']
When I use the !# > Run command I get these results:
2.6.10
/usr/local/bin:/usr/local/sbin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/go/bin:/Users/chris/.asdf/shims
That is the system ruby not the one a have set through asdf.
When I remove the shebang line from the script I get:
2.7.4
/Users/chris/.asdf/installs/ruby/2.7.4/bin:/Users/chris/.asdf/installs/ruby/2.7.4/lib/ruby/gems/.0/bin:/Users/chris/.asdf/shims:/usr/local/bin:/usr/local/sbin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/go/bin:/Applications/iTerm.app/Contents/Resources/utilities
This is the result I expect. It is also the result I get if I run the script from the terminal running zsh as my shell.
It's my understanding that BBEdit uses your shell's configuration when the shebang is available but makes it's best guess when it isn't. Am I correct?
This is my .zprofile
export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH"
eval "$(direnv hook zsh)"
export DIRENV_LOG_FORMAT=""
export JRUBY_OPTS="$JRUBY_OPTS -J-XstartOnFirstThread"
Does anyone else use asdf and ruby who can replicate this result?
Have you had a similar issue?
Any advice on how I might track this down?
Or am I off base and these are the expected results?
I'm working a a preview filter and it will only use the system version of ruby and that won't work for what I'm doing.