sstephenson/rbenv — Issue #123: Unable to run `rake` in Rubinius
Author: cookrn
Created: 2011-10-16 23:39:51+00:00
State: open

In both the 2.0.0-dev and 1.2.4 versions of rubinius installed using the [ruby-build](https://github.com/sstephenson/ruby-build) provided `rbenv install` subcommand, running `rake` results in the following error:

A syntax error has occurred:
Invalid char `\317' in expression
near line /Users/ryan/.rbenv/versions/rbx-2.0.0-dev/bin/rake:1, column 1

Code:
????
^

Backtrace:
Rubinius::Melbourne#syntax_error at /Users/ryan/.rbenv/versions/rbx-2.0.0-dev/runtime/18/melbourne.rbc:62
Rubinius::Melbourne#parse_file at /Users/ryan/.rbenv/versions/rbx-2.0.0-dev/runtime/18/melbourne.rbc:78
Rubinius::Compiler::FileParser#parse at /Users/ryan/.rbenv/versions/rbx-2.0.0-dev/runtime/18/compiler/stages.rbc:232
Rubinius::Compiler::Parser(Rubinius::Compiler::FileParser)#run at \
/Users/ryan/.rbenv/versions/rbx-2.0.0-dev/runtime/18/compiler/stages.rbc:215
Rubinius::Compiler#run at /Users/ryan/.rbenv/versions/rbx-2.0.0-dev/runtime/18/compiler/compiler.rbc:370
Rubinius::Compiler.compile at /Users/ryan/.rbenv/versions/rbx-2.0.0-dev/runtime/18/compiler/compiler.rbc:82
Rubinius::CodeLoader#compile_file at kernel/delta/codeloader.rb:164
Rubinius::CodeLoader#load_file at kernel/delta/codeloader.rb:145
Rubinius::CodeLoader#load_script at kernel/delta/codeloader.rb:61
Rubinius::CodeLoader.load_script at kernel/delta/codeloader.rb:107
Rubinius::Loader#script at kernel/loader.rb:618
Rubinius::Loader#main at kernel/loader.rb:772

Based on a brief conversation in the #rubinius Freenode IRC room, this may be caused by rubinius trying to run the `Rake` symlink in rbx/bin as a script. The rubinius `rbx` command supposedly treats invocations of itself as `rake` akin to running `rbx -S rake` and utilizes the shell environment gem paths to run the appropriate script.

Is it possible that the `rbenv` shims are distorting rubinius' ability to correctly locate the absolute path to the `Rake` gem binary?

I'm using:

* zsh with oh-my-zsh and no plugins
* `ruby-build` :: 20110928
* `rbenv` :: 0.2.1

My `PATH` is:

```
/Users/ryan/.rbenv/shims:/Users/ryan/.rbenv/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
```