Tried to install something via terminal and got sucked into a rabbit hole and accidentally deleted some shit (incl. Ruby & rbenv). Now whenever I open terminal it automatically feeds me this:
-bash: promlexport: command not found
-bash: rbenv: command not found
-bash: rbenv: command not found
-bash: rbenv: command not found
-bash: rbenv: command not found
I get that rbenv isn't working right now, but wtf is promlexport? I've googled it and literally 0 relevant searches come up… I'm working on a mac using the beta OS X Yosemite.
This is my .bash_profile (if that means anything to you — sure doesn't to me):
function proml {
case $TERM in
xterm*)
TITLEBAR='\[\0033]0;\u!\h:\w\007\]'
;;
*)
TITLEBAR=""
;;
esac
PS1="\u: \p\e[32m\1\W\[\e[0m\]l\n\[\e[0.31m\]❤️ \[\e[0m\]"
}
promlexport PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
PS – Might this be fixed when I update to the public OS X Yosemite?
I deleted the following from my .bash_profile:
promlexport PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
Of course, it fixed everything. Instead of trying to reinstall rbenv, I successfully installed rvn. Definitely a "duh" moment, but more importantly, a learning one.
Related
I have this line eval "$(rbenv init - zsh)" in my .zshrc. But it's throwing the command not found error for rbenv every time I start a new terminal. But rbenv works if I type it in manually, it only breaks when I start a new terminal. So in order for me to set a specific version for ruby, I need to run eval "$(rbenv init - zsh)" manually every time instead of relying on the terminal itself to run it automatically.
PS: I installed rbenv with Homebrew.
I have this line eval "$(rbenv init - zsh)" in my .zshrc.
The line should be after the rbenv binary location is loaded to the PATH environment variable.
Example:
export PATH="/home/someusername/.rbenv/bin:$PATH"
eval "$(rbenv init - zsh)"
I read a few Stack Overflow posts on a similar question, however, I cannot seem to fix my issue.
How do I get ruby --version to match the rbenv version?
rbenv version
2.6.5 (set by /Users/user/rubyonrails/lists/.ruby-version)
ruby --version
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
When I run
rbenv init
# Load rbenv automatically by appending
# the following to ~/.bash_profile:
eval "$(rbenv init -)"
I read a few other questions on Stack Overflow and modified my bash_profile accordingly, however it has not remedied the faulty rbenv init command.
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3
export PROJECT_HOME=$HOME/Django
source /usr/local/bin/virtualenvwrapper.sh
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/bin:$PATH"
Only add these lines on your .bashrc
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
later use this command $ rbenv install version-ruby
and for switch use $ rbenv global version-ruby
(replace version-ruby for the number of the version.)
When switching from bash to zsh, I looked up how to resolve an issue with my rbenv folder not being used correctly by zsh and found this:
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshenv
$ echo 'eval "$(rbenv init -)"' >> ~/.zshenv
$ echo 'source $HOME/.zshenv' >> ~/.zshrc
$ exec $SHELL
I ran all of these and seem to be using the correct rbenv folder now, but I get this error message whenever I open a new iTerm window:
/Users/myname/.zshenv:2: command not found: rbenv
What am I doing wrong? Any help would be very appreciated.
You need to add two things to your PATH.
First rbenv itself and second the ruby shims.
Part 1 rbenv
Installation
Homebrew
If you installed rbenv with brew,
then the rbenv executable should be linked to /usr/local/bin/rbenv.
See homebrew installation documentation for details.
Please add /usr/local/bin to your path PATH, if it is missing.
# in ~/.zshrc
export PATH=/usr/local/bin:$PATH
Github Checkout
If you install rbenv via a Github checkout, then the rbenv executalbe should be stored in ~/.rbenv/bin.
See github installation documentation for details.
Please add ~/.rbenv/bin to your path PATH, if it is missing.
# in ~/.zshrc
export PATH=$HOME/.rbenv/bin:$PATH
Verfiy
Please verify that rbenv is in your path by calling which rbenv.
The installation path should be returend.
Part 2 shims
Add the ruby shims to you path.
# in ~/.zshrc
eval "$(rbenv init -)"
Instead of the eval "$(rbenv init -)" command you can also add the shims folder directly.
# in ~/.zshrc
export RBENV_ROOT=$HOME/.rbenv
export PATH=$RBENV_ROOT/shims:/versions:$PATH
Part 3 rbenv doctor
You might also run the rbenv-doctor script mentioned here,
to check your installation.
I had the same problem...
when I ran ruby or rbenv, I got this error "command not found"
try this:
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshenv
echo 'eval "$(rbenv init - zsh)"' >> ~/.zshenv
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.zshenv
I had this same error. I could run which rbenv and rbenv just fine, but no matter what I would get command not found: rbenv. The issue was that I had eval "$(rbenv init -)" in my ~/.zshenv and not my ~/.zshrc file. You may still have the path to rbenv be added to $PATH within ~/.zshenv for it to work.
I'm trying to install ruby in terminal via homebrew.
So far I've entered:
brew install rbenv
and then I rain
rbenv init
after the command was run I received
# Load rbenv automatically by appending
# the following to ~/.bash_profile:
eval "$(rbenv init -)"
finally I entered:
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
I restarted my terminal per instructions and then received
rbenv: no such command `init-'
at the top of my new terminal.
error messages: rbenv: no such command `init-'
expected messages: nothing, blank terminal
The default shell (Bash before macOS 10.15) on macOS is a login shell. Only .bash_profile is used in initialization by default.
You need to put eval "$(rbenv init -)" into ~/.bash_profile but not ~/.bashrc.
Bash init files
login mode:
/etc/profile
~/.bash_profile, ~/.bash_login, ~/.profile (only first one that exists)
interactive non-login:
/etc/bash.bashrc (some Linux; not on Mac OS X)
~/.bashrc
non-interactive:
source file in $BASH_ENV
Check the path of the red line for an interactive, login shell on macOS.
References
Unix shell initialization
Shell startup scripts
I have made a launcher on my xubuntu desktop which calls a script named dev_blog.sh.
dev_blog.sh contains :
#!/usr/bin/zsh
echo ça marche
pyenv activate zinnia
/usr/bin/zsh
When I call the launcher from the desktop, my terminal opens and I can read :
dev_blog.sh:3: command not found: pyenv
Whereas when I type the same line in the same terminal, it works.
Here's the content of my .zshrc :
export ZSH=/home/proph73/.oh-my-zsh
ZSH_THEME="agnoster"
PATH="$HOME/bin:$HOME/.local/bin:$PATH"
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
source $ZSH/oh-my-zsh.sh`
PATH="$HOME/bin:$HOME/.local/bin:$PATH" move this to your .profile or use the full path to the executable in your shortcut $(which pyenv)