thoughtbot / laptop

A shell script to set up a macOS laptop for web and mobile development.
https://thoughtbot.com
MIT License
8.49k stars 1.91k forks source link

rbenv 'command not found' #300

Closed lblais closed 9 years ago

lblais commented 9 years ago

After script install. in zsh shell, when typing: $rbenv Command not found.

but if I am in bash shell, rbenv works fine.

domicode commented 9 years ago

check if you have something like

eval "$(rbenv init -)"
export PATH=/usr/local/bin:$PATH

in your .zshrc profile

lblais commented 9 years ago

all fixed.

pbrisbin commented 9 years ago

Those lines should've been added by laptop. That they weren't may indicate a bug.

Do you still have the install log? If not, we may need to close this and reopen with more details if it re-occurs.

lblais commented 9 years ago

here is the log. and my fixed .zshrc

Content of "laptop.log"

Updating system packages ...

Using aptitude ...
Ign http://ubuntu.mirror.constant.com trusty InRelease
Ign http://ubuntu.mirror.constant.com trusty-updates InRelease
Ign http://dl.google.com stable InRelease
Ign http://ubuntu.mirror.constant.com trusty-backports InRelease
Ign http://ubuntu.mirror.constant.com trusty-security InRelease
Hit http://dl.google.com stable Release.gpg
Hit http://ubuntu.mirror.constant.com trusty Release.gpg
Hit http://dl.google.com stable Release
Get: 1 http://ubuntu.mirror.constant.com trusty-updates Release.gpg [933 B]
Hit http://ubuntu.mirror.constant.com trusty-backports Release.gpg
Ign http://archive.canonical.com raring InRelease
Hit http://ubuntu.mirror.constant.com trusty-security Release.gpg
Hit http://dl.google.com stable/main amd64 Packages
Ign http://extras.ubuntu.com trusty InRelease
Hit http://ubuntu.mirror.constant.com trusty Release
Ign http://toolbelt.heroku.com ./ InRelease
Ign http://ppa.launchpad.net trusty InRelease
Get: 2 http://ubuntu.mirror.constant.com trusty-updates Release [59.7 kB]
Hit http://dl.google.com stable/main i386 Packages
Ign http://archive.canonical.com trusty InRelease
Hit http://toolbelt.heroku.com ./ Release.gpg
Hit http://extras.ubuntu.com trusty Release.gpg
Hit http://ubuntu.mirror.constant.com trusty-backports Release
Ign http://ppa.launchpad.net trusty InRelease
Hit http://ubuntu.mirror.constant.com trusty-security Release
Hit http://archive.canonical.com raring Release.gpg
Hit http://toolbelt.heroku.com ./ Release
Hit http://ubuntu.mirror.constant.com trusty/main Sources
Hit http://ubuntu.mirror.constant.com trusty/restricted Sources
Hit http://extras.ubuntu.com trusty Release
Hit http://ubuntu.mirror.constant.com trusty/universe Sources
Hit http://ubuntu.mirror.constant.com trusty/multiverse Sources
Ign http://ppa.launchpad.net trusty InRelease
Hit http://toolbelt.heroku.com ./ Packages
Hit http://archive.canonical.com trusty Release.gpg
Hit http://ubuntu.mirror.constant.com trusty/main amd64 Packages
Hit http://ubuntu.mirror.constant.com trusty/restricted amd64 Packages
Hit http://extras.ubuntu.com trusty/main Sources
Hit http://ubuntu.mirror.constant.com trusty/universe amd64 Packages
Hit http://archive.canonical.com raring Release
Hit http://ppa.launchpad.net trusty Release.gpg
Hit http://ubuntu.mirror.constant.com trusty/multiverse amd64 Packages
Ign http://dl.google.com stable/main Translation-en_CA
Hit http://extras.ubuntu.com trusty/main amd64 Packages
Hit http://ubuntu.mirror.constant.com trusty/main i386 Packages
Hit http://ubuntu.mirror.constant.com trusty/restricted i386 Packages
Ign http://dl.google.com stable/main Translation-en
Hit http://archive.canonical.com trusty Release
Hit http://ubuntu.mirror.constant.com trusty/universe i386 Packages
Hit http://ppa.launchpad.net trusty Release.gpg
Hit http://ubuntu.mirror.constant.com trusty/multiverse i386 Packages
Hit http://ubuntu.mirror.constant.com trusty/main Translation-en_CA
Hit http://extras.ubuntu.com trusty/main i386 Packages
Hit http://ubuntu.mirror.constant.com trusty/main Translation-en
Hit http://archive.canonical.com raring/partner Sources
Hit http://ubuntu.mirror.constant.com trusty/multiverse Translation-en
Hit http://ppa.launchpad.net trusty Release.gpg
Hit http://ubuntu.mirror.constant.com trusty/restricted Translation-en
Hit http://ubuntu.mirror.constant.com trusty/universe Translation-en_CA
Hit http://archive.canonical.com raring/partner amd64 Packages
Hit http://ubuntu.mirror.constant.com trusty/universe Translation-en
Get: 3 http://ubuntu.mirror.constant.com trusty-updates/main Sources [125 kB]
Hit http://ppa.launchpad.net trusty Release
Hit http://archive.canonical.com raring/partner i386 Packages
Ign http://toolbelt.heroku.com ./ Translation-en_CA
Ign http://toolbelt.heroku.com ./ Translation-en
Hit http://ppa.launchpad.net trusty Release
Get: 4 http://ubuntu.mirror.constant.com trusty-updates/restricted Sources [1,408 B]
Get: 5 http://ubuntu.mirror.constant.com trusty-updates/universe Sources [86.2 kB]
Get: 6 http://ubuntu.mirror.constant.com trusty-updates/multiverse Sources [3,531 B]
Hit http://ppa.launchpad.net trusty Release
Get: 7 http://ubuntu.mirror.constant.com trusty-updates/main amd64 Packages [337 kB]
Hit http://archive.canonical.com trusty/partner Sources
Hit http://ppa.launchpad.net trusty/main amd64 Packages
Hit http://archive.canonical.com trusty/partner amd64 Packages
Get: 8 http://ubuntu.mirror.constant.com trusty-updates/restricted amd64 Packages [5,820 B]
Hit http://ppa.launchpad.net trusty/main i386 Packages
Get: 9 http://ubuntu.mirror.constant.com trusty-updates/universe amd64 Packages [208 kB]
Hit http://archive.canonical.com trusty/partner i386 Packages
Hit http://ppa.launchpad.net trusty/main Translation-en
Get: 10 http://ubuntu.mirror.constant.com trusty-updates/multiverse amd64 Packages [9,366 B]
Hit http://archive.canonical.com trusty/partner Translation-en
Get: 11 http://ubuntu.mirror.constant.com trusty-updates/main i386 Packages [331 kB]
Hit http://ppa.launchpad.net trusty/main amd64 Packages
Ign http://extras.ubuntu.com trusty/main Translation-en_CA
Get: 12 http://ubuntu.mirror.constant.com trusty-updates/restricted i386 Packages [5,820 B]
Get: 13 http://ubuntu.mirror.constant.com trusty-updates/universe i386 Packages [209 kB]
Hit http://ppa.launchpad.net trusty/main i386 Packages
Ign http://extras.ubuntu.com trusty/main Translation-en
Get: 14 http://ubuntu.mirror.constant.com trusty-updates/multiverse i386 Packages [9,532 B]
Hit http://ubuntu.mirror.constant.com trusty-updates/main Translation-en
Hit http://ubuntu.mirror.constant.com trusty-updates/multiverse Translation-en
Hit http://ubuntu.mirror.constant.com trusty-updates/restricted Translation-en
Hit http://ubuntu.mirror.constant.com trusty-updates/universe Translation-en
Hit http://ubuntu.mirror.constant.com trusty-backports/main Sources
Hit http://ubuntu.mirror.constant.com trusty-backports/restricted Sources
Hit http://ubuntu.mirror.constant.com trusty-backports/universe Sources
Hit http://ubuntu.mirror.constant.com trusty-backports/multiverse Sources
Hit http://ubuntu.mirror.constant.com trusty-backports/main amd64 Packages
Hit http://ubuntu.mirror.constant.com trusty-backports/restricted amd64 Packages
Hit http://ubuntu.mirror.constant.com trusty-backports/universe amd64 Packages
Hit http://ppa.launchpad.net trusty/main amd64 Packages
Hit http://ubuntu.mirror.constant.com trusty-backports/multiverse amd64 Packages
Hit http://ubuntu.mirror.constant.com trusty-backports/main i386 Packages
Hit http://ppa.launchpad.net trusty/main i386 Packages
Hit http://ubuntu.mirror.constant.com trusty-backports/restricted i386 Packages
Hit http://ubuntu.mirror.constant.com trusty-backports/universe i386 Packages
Hit http://ubuntu.mirror.constant.com trusty-backports/multiverse i386 Packages
Hit http://ubuntu.mirror.constant.com trusty-backports/main Translation-en
Hit http://ubuntu.mirror.constant.com trusty-backports/multiverse Translation-en
Hit http://ubuntu.mirror.constant.com trusty-backports/restricted Translation-en
Hit http://ubuntu.mirror.constant.com trusty-backports/universe Translation-en
Hit http://ubuntu.mirror.constant.com trusty-security/main Sources
Hit http://ubuntu.mirror.constant.com trusty-security/restricted Sources
Hit http://ubuntu.mirror.constant.com trusty-security/universe Sources
Ign http://archive.canonical.com raring/partner Translation-en_CA
Hit http://ubuntu.mirror.constant.com trusty-security/multiverse Sources
Hit http://ubuntu.mirror.constant.com trusty-security/main amd64 Packages
Hit http://ubuntu.mirror.constant.com trusty-security/restricted amd64 Packages
Hit http://ubuntu.mirror.constant.com trusty-security/universe amd64 Packages
Ign http://archive.canonical.com raring/partner Translation-en
Hit http://ubuntu.mirror.constant.com trusty-security/multiverse amd64 Packages
Hit http://ubuntu.mirror.constant.com trusty-security/main i386 Packages
Hit http://ubuntu.mirror.constant.com trusty-security/restricted i386 Packages
Hit http://ubuntu.mirror.constant.com trusty-security/universe i386 Packages
Hit http://ubuntu.mirror.constant.com trusty-security/multiverse i386 Packages
Hit http://ubuntu.mirror.constant.com trusty-security/main Translation-en
Hit http://ubuntu.mirror.constant.com trusty-security/multiverse Translation-en
Hit http://ubuntu.mirror.constant.com trusty-security/restricted Translation-en
Hit http://ubuntu.mirror.constant.com trusty-security/universe Translation-en
Ign http://ubuntu.mirror.constant.com trusty/multiverse Translation-en_CA
Ign http://ubuntu.mirror.constant.com trusty/restricted Translation-en_CA
Ign http://ppa.launchpad.net trusty/main Translation-en_CA
Ign http://ppa.launchpad.net trusty/main Translation-en
Ign http://ppa.launchpad.net trusty/main Translation-en_CA
Ign http://ppa.launchpad.net trusty/main Translation-en
Fetched 1,393 kB in 4s (297 kB/s)
Reading package lists...

Installing git, for source control management ...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
Writing extended state information...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...

Installing base ruby build dependencies ...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...

Installing libraries for common gem dependencies ...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
Writing extended state information...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...

Installing sqlite3, for prototyping database-backed rails apps
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
Writing extended state information...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...

Installing Postgres, a good open source relational database ...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
Writing extended state information...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...

Installing Redis, a good key-value database ...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
Writing extended state information...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...

Installing ctags, to index files for vim tab completion of methods, classes, variables ...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
Writing extended state information...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...

Installing vim ...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
Writing extended state information...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...

Installing tmux, to save project state and switch between projects ...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
Writing extended state information...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...

Installing ImageMagick, to crop and resize images ...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
Writing extended state information...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...

Installing watch, to execute a program periodically and show the output ...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...

Installing curl ...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
Writing extended state information...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...

Installing zsh ...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
Writing extended state information...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...

Installing node, to render the rails asset pipeline ...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
Writing extended state information...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...

Changing your shell to zsh ...
Password: 

Installing Ruby 2.1.2 ...
/proc/self/fd/14: line 150: rbenv: command not found
failed

Content of ".zshrc"

# Set up the prompt

autoload -Uz promptinit
promptinit
prompt adam1

setopt histignorealldups sharehistory

# Use emacs keybindings even if our EDITOR is set to vi
bindkey -e

# Keep 1000 lines of history within the shell and save it to ~/.zsh_history:
HISTSIZE=1000
SAVEHIST=1000
HISTFILE=~/.zsh_history

# Use modern completion system
autoload -Uz compinit
compinit

zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' menu select=2
eval "$(dircolors -b)"
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true

zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
export PATH="$HOME/.bin:$PATH"

### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"

### ADDED MANUALLY BY ME
### exerpt taken from my .bashrc file
export PATH=$HOME/.rbenv/bin:$PATH
export PATH=$HOME/.rbenv/plugins/ruby-build/bin:$PATH
eval "$(rbenv init -)"
pbrisbin commented 9 years ago

Since your log never shows the "Installing rbenv" line, I have to conclude that this conditional returned false, meaning ~/.rbenv was already present, even if rbenv itself wasn't actually installed.

Is that possible?

lblais commented 9 years ago

hmmm, I think your are right... as it had been a long time since I installed rails stack on this System76 Laptop. it would make lots of sense now. I don't recall the laptop script saying anything reguarding, rbenv already installed skipping... please update your .zshrc file manually. Thanks for the help.

lblais commented 9 years ago

If you need anything more from me. Don't hesitate.

Thx

pbrisbin commented 9 years ago

Thanks for the report, and confirming the root issue. At this time, I don't feel a strong need to code around this particular edge-case. If others on the team feel differently, I'll let them reopen the issue.

creuter commented 9 years ago

I bumped into this over the weekend, and it looks like @stephenmdixon is now.

This was on a fresh install of Yosemite, and I think I installed dotfiles after the laptop script?

rm -rf ~/.rbenv then running these three commands manually fixed it: https://github.com/thoughtbot/laptop/blob/master/mac#L156-L159

pbrisbin commented 9 years ago

I'm fairly confident that this issue occurs when ~/.rbenv exists but rbenv isn't actually installed (or, more likely, the install is broken).

By "fresh install of Yosemite" do you really mean "fresh upgrade to Yosemite"? And did you have rbenv installed prior to the upgrade?

I could easily see a scenario like that causing this problem: changing a lot of things as part of the upgrade, but leaving ~/.rbenv as an artifact would certainly confuse laptop.

croaky commented 9 years ago

I ran Laptop on a brand new machine running Yosemite, with no import from a prior machine, no upgrade, and it ran clean. I wonder if https://github.com/thoughtbot/laptop/pull/324 would help with the upgrade for people who previously installed rbenv via Homebrew? Might still be a problem for people who installed from source.