pixelfairy
pixelfairy

Reputation: 1625

How do I get rid of the rbenv: "command not found" error I keep getting?

I installed rbenv with homebrew on my Mac (running OS X 10.9.5) and in the instructions on the rbenv github page it says:

Afterwards you'll still need to add eval "$(rbenv init -)" to your profile as stated in the caveats. You'll only ever have to do this once.

I have no idea how to add that. Where is my profile? ...and what caveats are they talking about?

I'm totally confused but I think as soon as I can figure this out I'll be able to move forward with setting up my development environment.

If it matters, when I run echo $PATH I get:

/usr/local/heroku/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/opt/ImageMagick/bin

Upvotes: 0

Views: 2769

Answers (3)

Londerson Araújo
Londerson Araújo

Reputation: 336

When you installed with Homebrew, check if export PATH=/opt/homebrew/bin:$PATH came after rbenv initialization.

Upvotes: 1

morgler
morgler

Reputation: 1809

I always install rbenv via homebrew. With the latest homebrew update I saw this rbenv error appear.

Installing the latest homebrew added the following line to my .bash_profile:

eval "$(/opt/homebrew/bin/brew shellenv)"

However, that line was inserted after the eval "$(rbenv init -)" call, so rbenv init actually tried to use the rbenv from the old homebrew location (which doesn't exist anymore).

The solution for me:

Move the homebrew line before the rbenv line in your .bash_profile (or .bashrc or whatever your shell has). That way the correct location will be used to find rbenv (and other tools you installed via homebrew).

Upvotes: 1

JAstuccio
JAstuccio

Reputation: 1580

Your profile is ~/.profile. You can add eval "$(rbenv init -)" to it by typing nano ~/.profile in terminal.

Upvotes: 1

Related Questions