Search code examples
ruby-on-railsrubyhomebrewrbenv

updated rbenv rails not found


I have updated all the brew formulas with brew update && brew upgrade. I after I upgrading I noticed that rails is not found but when I type

which rails

it returns /usr/bin/rails. All I can guess is I have to add rails path to .zshrc again. But, I am not sure what all I need to add to .zshrc file.

What are all the things that update broke.

.zshrc file

# Adding bin to PATH for sublime
export PATH="$PATH:~/bin"

# Rbenv stores data under ~/.rbenv by default. If you absolutely need to
# store everything under Homebrew's prefix, include this in your profile:
export RBENV_ROOT=/usr/local/var/rbenv

# MongoDB

export MONGO_PATH=/usr/local/Cellar/mongodb/3.0.7
export PATH=$PATH:$MONGO_PATH/bin

# Ruby Motion android tool
export RUBYMOTION_ANDROID_SDK=/Users/abhimanyuaryan/.rubymotion-android/sdk
export RUBYMOTION_ANDROID_NDK=/Users/abhimanyuaryan/.rubymotion-android/ndk

export DOTFILES=$HOME/.dotfiles
export ZSH=$DOTFILES/zsh

# display how long all tasks over 10 seconds take
export REPORTTIME=10

[[ -e ~/.terminfo ]] && export TERMINFO_DIRS=~/.terminfo:/usr/share/terminfo

# define the code directory
# This is where my code exists and where I want the `c` autocomplete to work from exclusively
if [[ -d ~/code ]]; then
    export CODE_DIR=~/code
fi

# source all .zsh files inside of the zsh/ directory
for config ($ZSH/**/*.zsh) source $config

if [[ -a ~/.localrc ]]; then
    source ~/.localrc
fi


# initialize autocomplete
autoload -U compinit
compinit

for config ($ZSH/**/*completion.sh) source $config

export EDITOR='nvim'

export PATH=/usr/local/bin:$PATH

# add /usr/local/sbin
if [[ -d /usr/local/sbin ]]; then
    export PATH=/usr/local/sbin:$PATH
fi

# adding path directory for custom scripts
export PATH=$DOTFILES/bin:$PATH

# check for custom bin directory and add to path
if [[ -d ~/bin ]]; then
    export PATH=~/bin:$PATH
fi

[ -z "$TMUX" ] && export TERM=xterm-256color

# install rbenv
if hash rbenv 2>/dev/null; then
    eval "$(rbenv init -)"
fi

if [[ -d ~/.rvm ]]; then
    PATH=$HOME/.rvm/bin:$PATH # Add RVM to PATH for scripting
    source ~/.rvm/scripts/rvm
fi

# alias git to hub
if hash hub 2>/dev/null; then
    eval "$(hub alias -s)"
fi

# source nvm
export NVM_DIR=~/.nvm

if hash brew 2>/dev/null; then
    source $(brew --prefix nvm)/nvm.sh
    source `brew --prefix`/etc/profile.d/z.sh
fi


# Base16 Shell
# if [ -z "$THEME" ]; then
    export THEME="base16-eighties"
# fi
if [ -z "$BACKGROUND" ]; then
    export BACKGROUND="dark"
fi


BASE16_SHELL="$DOTFILES/.config/base16-shell/$THEME.$BACKGROUND.sh"
# [[ -s $BASE16_SHELL ]] && source $BASE16_SHELL
source $BASE16_SHELL

export NVM_DIR=~/.nvm
  . $(brew --prefix nvm)/nvm.sh


# Online help for ZSH
  unalias run-help
  autoload run-help
  HELPDIR=/usr/local/share/zsh/help

Solution

  • The only solution I came across is to re-install ruby & rails. I think while upgrading rbenv existing install somehow got removed

    # Install Ruby
    rbenv install 2.2.3
    rbenv global 2.2.3
    ruby -v
    
    gem install rails -v 4.2.4
    
    rbenv rehash
    
    rails -v
    # Rails 4.2.4