rbenv / rbenv Goto Github PK
View Code? Open in Web Editor NEWManage your app's Ruby environment
License: MIT License
Manage your app's Ruby environment
License: MIT License
I wasn't sure whether to post this bug here or on rbenv-gemsets
, so I'm putting it here and cc-ing @jamis.
Once you have rbenv-gemsets
installed, rehashing can produce a spurious file in shims
called *
(no joke). I can't even figure out a way to explain it briefly, so I'm just going to show how I found it:
At the top of make_shims
in rbenv-rehash
add echo "glob: $@"
Run rbenv rehash
Get this result:
glob: ../versions/1.9.2-p290/bin/erb ../versions/1.9.2-p290/bin/gem ../versions/1.9.2-p290/bin/irb ../versions/1.9.2-p290/bin/rake ../versions/1.9.2-p290/bin/rdoc ../versions/1.9.2-p290/bin/ri ../versions/1.9.2-p290/bin/ruby ../versions/1.9.2-p290/bin/testrb
glob: /Users/telemachus/.rbenv/versions/*/gemsets/*/bin/*
That second item gets truncated to *
, a file of that name is created and then treated as a proper shim. At the moment, this isn't a huge deal, but it's worth considering now before the gemsets idea grows.
How do you run gem executables without Bundler / bundle exec
?
~ $ rbenv rehash
~ $ rbenv global
1.9.2-p290
~ $ gem which rails
/Users/meleyal/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails.rb
~ $ rails new test
rbenv: rails: command not found
The `rails' command exists in these Ruby versions:
1.8.7-p352
~ $ bundle exec rails new test
Could not locate Gemfile
Personally I found working with rvm to be good until you upgraded rvm itself. It seemed every release would have odd quirks with failures and unpredictable exit codes (ie 0 on error). Personally I found rvm terribile to script against (think chef), as each release it seemed to change its exit codes and/or improperly handle failure. This among many other issues could be mostly eradicated with a proper test suite.
I realize that rbenv is a shell based application, but I strongly suggest cucumber/aruba features that focus on ensuring that rbenv returns proper exit codes and is scriptable, unix style. Simply ensuring the external command line interface behaves consistently across releases.
I would be happy to start on something like this if the approach is agreeable.
Thanks again for rbenv! It is much needed!
Executing rbenv without arguments gives the following error.
rbenv:shift:2: shift count must be <= $#
Can I install rbenv somewhere on the dropbox folder so that I can share the gems and the versions across my macs? It looks by default it stores the global version in ~/.rbenv/global
When configuring a new ruby install, it requires an absolute path, instead of the ~/.rbenv from the README.
Already done for a couple of files:
https://github.com/sstephenson/rbenv/blob/master/libexec/rbenv-rehash
https://github.com/sstephenson/rbenv/blob/master/bin/ruby-local-exec
Related: #39
Hey , very minor issue with the README, but in the installation instructions you echo a couple lines into .bash_profile and then do an exec to load them.
This doesn't work on Ubuntu because it uses .profile instead and xterms use .bashrc. I think it would be clearer if the readme just told you to execute those lines in your terminal and then left it up to the reader to decide if and where they should put them so that they autoload in the future. Or there could be just a note of warning there that .bash_profile might not be the correct place.
Just did a fresh install of rbenv from github. "rbenv rehash" with no Rubies installed at all produced the "*" shim:
% ls -l ~/.rbenv/shims
total 0
% rbenv rehash
% ls -l ~/.rbenv/shims
total 4
-rwxr-xr-x 1 wisq wisq 59 2011-08-17 14:29 *
I'm assuming this is the same as #12, i.e. lack of nullglob setting.
When I use tmux ruby can't find any installed gems. Ruby tells me gem is not installed, and gem list produces nothing. Outside of tmux everything works. Could be some oddity about my setup but I'm not sure. I have zsh + oh-my-zsh and tmux 1.4
gem install rails
=> dont have permissions to write in the gems directory
sudo gem install rails
=> unknow gem command
i just cloned the project and added the bin path to PATH, but get an error from env.
$ rbenv
/usr/bin/env: bash -e: No such file or directory
$ head -1 .rbenv/bin/rbenv
$ env bash -e
$
Hey - thanks for rbenv!
When using rubinius, any gems with executables don't get installed into ~/.rbenv/versions/rbx-1.2.4/bin/ and therefore aren't found by the shim on rehash.
I have a few projects that need OS X Lion's system Ruby, so I put a .rbenv-local
file in there with system
in it.
However, when I try to execute ruby or any command that uses ruby (like rake), I get errors like this:
/Users/cypher/.rbenv/libexec/rbenv-version-file-read: fork: Resource temporarily unavailable
/Users/cypher/.rbenv/libexec/rbenv: fork: Resource temporarily unavailable
/Users/cypher/.rbenv/libexec/rbenv-version-file: fork: Resource temporarily unavailable
I've run ruby -v
with $RBENV_DEBUG=1
, and this is the (shortened) output I get: https://gist.github.com/565a7eaf4425a8c60840
The whole output actually takes up 50MB, but I can put it up somewhere if you need it.
It looks like rbenv gets caught in an infinite loop, and keeps adding /Users/cypher/.rbenv/libexec
to $PATH
.
I use zsh (version 4.3.11), the rbenv repo is at 568cd4b.
I've installed the latest Pow and rbenv. I setup ruby-1.9.2-p290 and Pow is just not seeing it. I ran the rbenv set-local and rbenv set-default commands to enforce the 1.9.2, but it's not being detected correctly. Please help
LoadError: no such file to load -- bundler/setup
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
~/rails/rails-project/config/boot.rb:6
~/rails/rails-project/config/application.rb:1:in `require'
~/rails/rails-project/config/application.rb:1
~/rails/rails-project/config/environment.rb:2:in `require'
~/rails/rails-project/config/environment.rb:2
~/rails/rails-project/config.ru:3:in `require'
~/rails/rails-project/config.ru:3
~/Library/Application Support/Pow/Versions/0.3.1/node_modules/nack/lib/nack/builder.rb:4:in `instance_eval'
~/Library/Application Support/Pow/Versions/0.3.1/node_modules/nack/lib/nack/builder.rb:4:in `initialize'
~/rails/rails-project/config.ru:1:in `new'
~/rails/rails-project/config.ru:1
Add an option similar to git's --git-dir
option for specifying where rbenv looks for the versions
and shims
directories and where rbenv stores the default
file.
The path of this "data dir" would default to $HOME/.rbenv
.
Use Cases would be:
rbenv
, e.g. PHP or Python in addtion to RubyIt would seem to be simple enough to detect a "gem.*install" command in the shims and then call rbenv rehash afterwards as a default... would their be an objection to a patch doing just this? Seems I keep installing gems with binaries and having to rehash to get them to work...
When I try to execute rake on a project that rbenv is set to ruby 1.9.2 I get this error:
Could not find rake-0.9.2 in any of the sources
Runbundle install
to install missing gems.
I've already ran 'bundle install' and everything looks fine. Except that the command doesn't work.
$ cd my-project
$ rbenv local
=> 1.9.2-p290
$ ruby --version
=> ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.1.0]
$ which rake
=> /Users/felipecypriano/.rbenv/shims/rake
I've already ran 'rbenv rehash' several times as well.
Any ideas on how to fix this?
-S Makes Ruby use the PATH environment variable to search for
script, unless if its name begins with a slash. This is
used to emulate #! on machines that don't support it, in
the following manner:
#! /usr/local/bin/ruby
# This line makes the next one a comment in Ruby \
exec /usr/local/bin/ruby -S $0 $*
When you pass the -S foo
flag to Ruby, it finds foo
in $PATH
, then scans the first line of the file to see if it's a Ruby program and re-execs: https://github.com/ruby/ruby/blob/trunk/ruby.c#L1549-1562
The Rubinius installer uses this:
/Users/sam/.rbenv/versions/1.9.3-preview1/bin/ruby -S rake -r /private/tmp/ruby-build.10166-13998/rubinius-1.2.4/config.rb -r /private/tmp/ruby-build.10166-13998/rubinius-1.2.4/rakelib/ext_helper.rb -r /private/tmp/ruby-build.10166-13998/rubinius-1.2.4/rakelib/dependency_grapher.rb build:mri
/Users/sam/.rbenv/versions/1.9.3-preview1/bin/ruby: no Ruby script found in input (LoadError)
rake aborted!
Command failed with status (1): [/Users/sam/.rbenv/versions/1.9.3-preview1/...]
One workaround would be to change our shims' shebang to point to another shim in our libexec directory with ruby
in the name.
Another workaround would be for rbenv-exec
to prepend $PATH
with the current version's prefix, so that children of any Ruby process will find the actual binaries in the path before our shims. The downside here is that you wouldn't be able to modify RBENV_VERSION
in a Ruby process to spawn a child with a different version, though I'm not sure that's actually useful.
If RBENV_VERSION
is system
, then rbenv should remove itself from PATH
so that the system Ruby and associated commands have precedence.
I've installed a few gems with bundler, run rbenv rehash
but it still can't find them:
╭─haim@sunra ~ ‹1.8.7-p352›
╰─$ rbenv rehash
╭─haim@sunra ~ ‹1.8.7-p352›
╰─$ rbenv which knife
rbenv: knife: command not found
╭─haim@sunra ~ ‹1.8.7-p352›
╰─$ gem contents chef 127 ↵
/Users/haim/.rbenv/versions/1.8.7-p352/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/chef-client
/Users/haim/.rbenv/versions/1.8.7-p352/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/chef-solo
/Users/haim/.rbenv/versions/1.8.7-p352/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/knife
/Users/haim/.rbenv/versions/1.8.7-p352/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/shef
The same goes for other gems (like thor, etc..). I can run them with bundle exec knife
without a problem.
BTW, I'm using zsh.
Thanks in advance
Haim
Format the readme nicely for http://rbenv.org/
After following the installation instructions, all calls to rbenv die with:
/usr/bin/env: bash -e: Permission denied
Shell versions:
% bash --version
GNU bash, version 4.1.9(2)-release (x86_64-pc-linux-gnu)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
2:10:43 testo@corinth: ~/.rbenv/libexec
% zsh --version
zsh 4.3.10 (x86_64-pc-linux-gnu)
It would be nice if rbenv could use other rubies, especially system-wide. Perhaps an environment variable akin to $PATH (perhaps $RBENVS) that includes places to look.
I installed rbenv on a new machine (beefy Macbook Pro) and I'm fairly disappointed because it makes all ruby commands (tested with ruby
, irb
, gem
) quite slow.
$ time ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]
real 0m2.859s
user 0m2.155s
sys 0m0.682s
$ time ~/.rbenv/versions/1.9.2-p290/bin/ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]
real 0m0.019s
user 0m0.004s
sys 0m0.004s
I did a cursory glance into what rbenv is doing, and it doesn't seem to be one particular slow thing -- just a lot of shell operations.
Nobody seems to be talking about this -- am I doing something completely wrong? I was hoping to replace RVM with my rbenv in my dev environment, but the 2-3 second latency is painful.
Manually sourcing the script doesn't work, but adding it to my $fpath does (that is, making a symlink named _rbenv in a directory in my $fpath).
So that we don't need to depend on hard-coded relative pathnames.
FHiMac2:.rbenv alexa$ rbenv rehash
ln: erb: Operation not supported
This is after following the instructions as written in the readme and using ruby-build.
Please let me know what other information you may need.
Looks like, gdb does not like shims (which is obvious).
This GDB was configured as "x86_64-apple-darwin"..."/Users/gnufied/.rbenv/shims/ruby": not in executable format: File format not recognized
I am not sure, if this is a bug per-se - but definitely invoking debugger makes harder than needs be.
IMO it's clearer to call entries in ~/.rbenv/versions/
"prefixes" instead of "paths".
Add an rbenv-whence
command that takes a single command name as an argument and shows you which versions of Ruby have that command. For example, if you have Bundler installed in 1.9.2-p290 and 1.9.3-preview1, but not 1.8.7-p352, rbenv whence bundle
would print
1.9.2-p290
1.9.3-preview1
$ sudo gem install rails
Successfully installed rails-3.0.10
1 gem installed
Installing ri documentation for rails-3.0.10...
file 'lib' not found
Installing RDoc documentation for rails-3.0.10...
file 'lib' not found
Can't fix this by installing rdoc first, as was done in an early pre-release of Rails-3.0.0.
Pretty much everything else works fine.
When I install a gem that provides executables the binary shims don't seem to be created, but the gem installs fine and the binaries are in the 'right' place.
I've run rbenv rehash with no luck.
$ rbenv 2>&1 |head -1
rbenv 0.2.0-pre
$ rbenv version
ree-1.8.7-2011.03 (set by /home/test/.rbenv-version)
$ gem list
*** LOCAL GEMS ***
$ gem install rake --no-rdoc --no-ri
Successfully installed rake-0.9.2
1 gem installed
$ rbenv rehash
$ rake
-bash: rake: command not found
$ rbenv shims
/home/test/.rbenv/shims/erb
/home/test/.rbenv/shims/gem
/home/test/.rbenv/shims/irb
/home/test/.rbenv/shims/rdoc
/home/test/.rbenv/shims/ree-version
/home/test/.rbenv/shims/ri
/home/test/.rbenv/shims/ruby
/home/test/.rbenv/shims/testrb
$ gem contents rake
/home/test/.rbenv/versions/ree-1.8.7-2011.03/lib/ruby/gems/1.8/gems/rake-0.9.2/bin/rake
This last part is odd to me as well why so little is listed with gem contents.
$ find /home/test/.rbenv/versions/ree-1.8.7-2011.03/lib/ruby/gems/1.8/gems/rake-0.9.2/ | wc -l
181
When running any gem command with JRuby, I get an error. For example:
cboyd@cboyd-imac ~ $> jruby -S gem list
NameError: undefined local variable or method `e' for main:Object
(root) at /Users/cboyd/.rbenv/shims/gem:2
Let me know if you need more info.
I keep getting this after switching from rvm to rbenv:
/usr/local/bin/brew: line 4: syntax error near unexpected token (' /usr/local/bin/brew: line 4:
HOMEBREW_BREW_FILE = ENV['HOMEBREW_BREW_FILE'] = File.expand_path(FILE)'
I made sure there is only one ruby version installed:
which -a ruby
/Users/tim/.rbenv/shims/ruby
The install procedure should run extconf.rb for the openssl extension for the version of ruby downloaded, make and install it.
When running gem cleanup, I get errors like this
Attempting to uninstall rdoc-3.9.1
Unable to uninstall rdoc-3.9.1:
Gem::InstallError: gem "rdoc" is not installed
Attempting to uninstall rails-3.0.3
Unable to uninstall rails-3.0.3:
Gem::InstallError: gem "rails" is not installed
Attempting to uninstall railties-3.0.3
Unable to uninstall railties-3.0.3:
Gem::InstallError: gem "railties" is not installed
Attempting to uninstall newrelic_rpm-3.0.1
Unable to uninstall newrelic_rpm-3.0.1:
Gem::InstallError: gem "newrelic_rpm" is not installed
If I continue running gem cleanup, the gems uninstall one by one, erroring on the gems next in the list. In the event of a Y/N question to uninstall, selecting no causes you to get stuck there on next run because that gem is next in line.
I was reading thru issue #8 and noticed that rbenv global system
is not working in the master version.
(kencollins@mc1) - (~)
∴ rbenv global system
rbenv: ruby: command not found
The `ruby' command exists in these Ruby versions:
1.9.3
ree
The way shims are currently implemented, rehash wipes the existing shims dir and rebuilds shims for the current ruby. This is problematic: if I have ruby set to (e.g.) 1.8.7 and rehash, it might put "cap" and "bundle" shims there. Then, in another terminal session, I switch to (e.g.) 1.9.2 and rehash. Unless 1.9.2 has the same gems as 1.8.7, I'll lose some (or all) of my shimmed gem executables, so that if I switch back to the first terminal session and try to "cap deploy" (or something), it fails, because the shim is missing.
I'm not sure what the right way to solve this is, aside from maybe never wiping the shims dir, but that has its own problems.
Hi all,
I've installed gems such as rails and bundler (not using sudo), wanting rails
and bundle
to be omnipresent with rbenv, I copied an existing shim and named it as the executable name.
This way works pretty well for me, however, is this the intended usage?
Update: I'm using zsh and Ubuntu.
Thanks
As the repo here is updated, how does one keep up to date? Do you just git pull an updated repo and run the init again?
If the terminal starts with custom shell then
occurs loading rbenv.bash instead rbenv.zsh
Because $1 is empty and $SHELL is just default shell, not current
shell="$1"
if [ -z "$shell" ]; then
shell="$(basename "$SHELL")"
fi
Since we'll be supporting system wide installs via homebrew, I'd like to establish some conventions for global config and installed files.
I know Sam likes the simplicity of ~/.rbenv
, but I don't really like putting compiled programs in my ~
.
We already have something for plugins, a global /etc/rbenv.d
directory.
RBENV_EXEC_PLUGINS=(/etc/rbenv.d/exec/*.bash ${HOME}/.rbenv/rbenv.d/exec/*.bash)
We should probably look for /etc/rbenv.d/default
here too.
As for ~/.rbenv/versions
, I'd like to see them under /usr/local/lib/rbenv
. Not sure if thats the correct place.
Also don't know where shims would go.
I'd be cool if we supported the unix hierarchy so that ~/.rbenv/default
was checked first, then /usr/local/etc/rbenv.d/default
, then /etc/rbenv.d/default
. Maybe thats unnecessary.
Not exactly sure what's going on here, but when I open something with MacVim, e.g. mvim .
, I get an error complaining github-markup
isn't installed. So I gem install github-markup
. And it installs, but when I open MacVim the error persists. I also noticed I can't require 'github-markup'
in irb
.
I have been trying to fix this issue I can't seem to workaround. I followed the installation instructions for rbenv and ruby-build. I used ruby-build to install 1.9.2. I set rbenv to use the system install (1.8.7) as the default. I have a Mac so I'd like to keep that default as I need it currently for a work project that still uses that version. When opening a new tab in Terminal and I type ruby
I see the following error
rbenv: ruby: command not found
The `ruby' command exists in these Ruby versions:
1.9.2-p290
Not sure why its stating rbenv if I set the global default to system. If I run rbenv global
it outputs a value of system
as expected (from what I understand) but it seems that whenever attempting to use the ruby command in any shell its not working. I set a local version to a specific project and using the ruby
command works fine there. Any ideas? I'm sure I'm just missing something.
I followed the instructions, but it didn't work right. I'm not even sure what happened. When I subsequently did a bundle install
I was instructed to enter my password to install the gems, but they didn't actually install even though it looked like they did. This seems consistent with your warning in the README, but I followed the installation instructions to a T.
I am using OS X Lion.
I got it working after closing and restarting my shell and running rbenv rehash
again. I did run exec
to restart the shell originally as instructed but that must've not done the trick.
Looks likes it's trying to execute bundle
as a bash script
➜ helix git:(develop) ✗ rbenv |& head -n 1
rbenv 0.2.0-pre
➜ helix git:(develop) ✗ rbenv version
jruby-1.6.4 (set by RBENV_VERSION environment variable)
➜ helix git:(develop) ✗ bundle
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 9: require: command not found
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 11: version: command not found
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 13: syntax error near unexpected token `('
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 13: `if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then'
➜ helix git:(develop) ✗
I've got some trouble when trying update 'system' rubygems under rbenv control.
[space@microb ~]$ rbenv global system
[space@microb ~]$ rbenv version
system (set by /home/space/.rbenv/global)
[space@microb ~]$ sudo gem update --system
Password:
rbenv: version `' is not installed
[space@microb ~]$
Looks like 'system' version isn't considered as full-featured version in rbenv sense. I thought it would be good idea to interprete 'rbenv global system' as switching rbenv off. At least in the current shell context...
The other solution is a processing 'system' as a standard rbenv version and shims exe's to system one in regular way.
Tnx...
Are there any best practices on how to test multiple different versions of ruby against a single codebase that is using budler?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.