-1

I have changed the name of the admin account of my mac (from edward to edxu96). When I want to continue updating my website, which is in Jekyll and hosed in GitHub, I found the old admin name is still in the execution path.

I have reinstalled rbenv and ruby-build using Homebrew. I did check the following codes in .zshrc:

# Set Ruby working directory
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH=$HOME/.gem/ruby/2.6.0/bin:$PATH

These are the output from my operations:

$ bundle check
zsh: /Users/edxu96/.gem/ruby/2.6.0/bin/bundle: bad interpreter: /Users/edward/.rbenv/versions/2.6.2/bin/ruby: no such file or directory
/usr/local/Cellar/rbenv/1.1.2/libexec/rbenv-exec: /Users/edxu96/.rbenv/versions/2.6.2/bin/bundle: /Users/edward/.rbenv/versions/2.6.2/bin/ruby: bad interpreter: No such file or directory
/usr/local/Cellar/rbenv/1.1.2/libexec/rbenv-exec: line 47: /Users/edxu96/.rbenv/versions/2.6.2/bin/bundle: Undefined error: 0

$ bundle update all
zsh: /Users/edxu96/.gem/ruby/2.6.0/bin/bundle: bad interpreter: /Users/edward/.rbenv/versions/2.6.2/bin/ruby: no such file or directory
/usr/local/Cellar/rbenv/1.1.2/libexec/rbenv-exec: /Users/edxu96/.rbenv/versions/2.6.2/bin/bundle: /Users/edward/.rbenv/versions/2.6.2/bin/ruby: bad interpreter: No such file or directory
/usr/local/Cellar/rbenv/1.1.2/libexec/rbenv-exec: line 47: /Users/edxu96/.rbenv/versions/2.6.2/bin/bundle: Undefined error: 0

$ gem install bundler
/usr/local/Cellar/rbenv/1.1.2/libexec/rbenv-exec: /Users/edxu96/.rbenv/versions/2.6.2/bin/gem: /Users/edward/.rbenv/versions/2.6.2/bin/ruby: bad interpreter: No such file or directory
/usr/local/Cellar/rbenv/1.1.2/libexec/rbenv-exec: line 47: /Users/edxu96/.rbenv/versions/2.6.2/bin/gem: Undefined error: 0

I checked using which command. I think there may be something wrong with gem.

$ which bundle
/Users/edxu96/.gem/ruby/2.6.0/bin/bundle

$ which ruby
/Users/edxu96/.rbenv/shims/ruby
$ which rbenv
rbenv () {
    local command
    command="${1:-}"
    if [ "$#" -gt 0 ]
    then
        shift
    fi
    case "$command" in
        (rehash | shell) eval "$(rbenv "sh-$command" "$@")" ;;
        (*) command rbenv "$command" "$@" ;;
    esac
}

$ curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash
Checking for `rbenv' in PATH: /usr/local/bin/rbenv
Checking for rbenv shims in PATH: OK
Checking `rbenv install' support: /usr/local/bin/rbenv-install (ruby-build 20190423)
Counting installed Ruby versions: 1 versions
Checking RubyGems settings: OK
Auditing installed plugins: OK
$ which gem
gem () {
    \typeset result
    (
        \typeset rvmrc
        rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc")
        if [[ -n "${rvm_prefix:-}" ]] && ! [[ "$HOME/.rvmrc" -ef "${rvm_prefix}/.rvmrc" ]]
        then
            rvm_rvmrc_files+=("${rvm_prefix}/.rvmrc")
        fi
        for rvmrc in "${rvm_rvmrc_files[@]}"
        do
            [[ -s "${rvmrc}" ]] && source "${rvmrc}" || true
        done
        unset rvm_rvmrc_files
        command gem "$@"
    ) || result=$?
    hash -r
    return ${result:-0}
}

I have tried to reinstall it according to reinstall rubygems. But I got the following.

$ ruby setup.rb
Traceback (most recent call last):
    1: from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
<internal:gem_prelude>:2:in `require': cannot load such file -- rubygems.rb (LoadError)
Edward
  • 554
  • 8
  • 15

1 Answers1

0

Seems like you installed your Ruby environment and its gems using Homebrew. I'd consider reinstalling using Homebrew.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Jacob Helton
  • 173
  • 9
  • I have reinstalled `rbenv` and `ruby-build`. It still doesn't work. I think there is some problem in `gem`. How can I reinstall `gem`? – Edward Jul 31 '19 at 11:17