Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is there supposed to be a ~/.rbenv/bin directory? #38

Open
salex opened this issue Apr 3, 2014 · 10 comments
Open

is there supposed to be a ~/.rbenv/bin directory? #38

salex opened this issue Apr 3, 2014 · 10 comments

Comments

@salex
Copy link

salex commented Apr 3, 2014

I have a server (OS X server) running several small rails applications. I had initially set it using brew to install ruby (could not get rvm to install!). I made some changes to one of the apps and ran into all kinds of problems with I updated the brew ruby version. I decided to try rbenv and set it up on the server. Lots of problems with clashes with the brew version that I eventually figured out.

I then tried to deploy and discovered that my bundle update loaded capistrano 3.1 and nothing worked. I started the conversion processes and I got stuck on:

set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec"

I have no bin directory on what brew installed for rbenv. I changed it to:

set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} /usr/local/bin/rbenv exec"

and got it to work, but maybe I'm missing something. I did get a basic deploy to work, but still have to get the rest of my 'railscast/recipes' to work, like writing plists for launchd etc.

@kirs
Copy link
Member

kirs commented Apr 3, 2014

If you use Homebrew, your rbenv_ruby path should be /usr/local/Cellar/rbenv/0.4.0

@kirs
Copy link
Member

kirs commented Apr 3, 2014

That means you don't need to change rbenv_prefix at all.

@salex
Copy link
Author

salex commented Apr 3, 2014

Thank you. Knew it had to be simpler. Again, new to rbenv and did the Capistrano using the recipes screencasts, not really understanding Capistrano -- I'll work on that.

@mech
Copy link

mech commented Nov 4, 2014

@salex, did you manage to get it working?

Is it as such:

set :rbenv_ruby, '/usr/local/Cellar/rbenv/0.4.0'

Don't think that is working on my side. Also do we need the .ruby-version file?

@kirs
Copy link
Member

kirs commented Nov 5, 2014

@mech rbenv_ruby should point to ruby version, not the directory with rbenv

@mech
Copy link

mech commented Nov 7, 2014

If I put the config as such

set :rbenv_type, :user
set :rbenv_ruby, '2.1.4'

I will get this error

bash: /Users/mech/.rbenv/bin/rbenv: No such file or directory

That's why it is puzzling how come it need to find such directory on a Mac OS X setup. I feel that it is like only for Linux. Obviously in a Mac using a typical install of rbenv with Homebrew, there is no such directory :(

@shawnpyle
Copy link

Based on the settings listed in the Usage section of capistrano/rbenv, the following worked by changing the path to the actual rbenv executable (/usr/local/bin/rbenv).

set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} /usr/local/bin/rbenv exec"

@ghost
Copy link

ghost commented Aug 25, 2016

I had to set :rbenv_path, '/usr/local/opt/rbenv' in addition to @shawnpyle's solution to get rbenv to find the bundler executable.

@jDeppen
Copy link

jDeppen commented Sep 20, 2017

@kirs, did you mean that this is already the default for rbenv_ruby and there's nothing to set?

If you use Homebrew, your rbenv_ruby path should be /usr/local/Cellar/rbenv/0.4.0

I'm wondering because you also said:

@mech rbenv_ruby should point to ruby version, not the directory with rbenv


Does this mean 'don't even set (rather than change) rbenv_prefix at all':

That means you don't need to change rbenv_prefix at all.


To avoid /Users/jason/.rbenv/bin/rbenv: No such file or directory, I had to:
ln -s /usr/local/Cellar/rbenv/1.1.1/bin ~/.rbenv/bin
Of course, this will break when rbenv is updated.

What's the proper way to set this up when installing with Homebrew? Thank you!

related: #52

@brendon
Copy link

brendon commented May 7, 2021

In my case I installed the Ubuntu rbenv package. This seems to place the binary elsewhere (outside of the .rbenv path). To fix this you need to configure it explicitly:

set :rbenv_prefix, '/usr/bin/rbenv exec'

Use which rbenv on your server to find the correct location.

You can see the logic around this here::

rbenv_prefix = fetch(:rbenv_prefix, proc { "#{fetch(:rbenv_path)}/bin/rbenv exec" })

set :rbenv_path, -> {
rbenv_path = fetch(:rbenv_custom_path)
rbenv_path ||= case fetch(:rbenv_type, :user)
when :system
'/usr/local/rbenv'
when :fullstaq
'/usr/lib/rbenv'
else
'$HOME/.rbenv'
end
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants