rails: command not found

254 views
Skip to first unread message

Bill Barnett

unread,
Mar 11, 2014, 1:49:33 PM3/11/14
to cincin...@googlegroups.com
OK, seems I do this dance everytime I start a green field Rails project. Posting here so I'll have somewhere to consult the rest of my career...

Here's the deal (not rbenv)

chip: agilous/monmentum $ rails s
rbenv: rails: command not found

The `rails' command exists in these Ruby versions:
  1.8.7-p334
  1.9.3-p374
  1.9.3-p392
  1.9.3-p448
  2.0.0-p247
  2.0.0-p353

chip: agilous/monmentum $ which rails
./bin/rails
chip: agilous/monmentum $ echo $PATH
./bin:/usr/local/bin:/Users/bbarnett/bin:/Users/bbarnett/.rbenv/shims:/Users/bbarnett/.rbenv/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/go/bin:/usr/local/share/npm/bin

What am I continuing to miss?!

Thanks

Chris Moore

unread,
Mar 11, 2014, 1:50:27 PM3/11/14
to cincin...@googlegroups.com
`source ~/.bash_profile` and try again.


--

---
You received this message because you are subscribed to the Google Groups "Cincinnati.rb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cincinnatirb...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Thanks,
Chris

Bill Barnett

unread,
Mar 11, 2014, 1:53:23 PM3/11/14
to cincin...@googlegroups.com
That's the secret sauce! Thank you!

Chris Moore

unread,
Mar 11, 2014, 1:54:07 PM3/11/14
to cincin...@googlegroups.com
I wish someone smarter than me would explain why that happens.

Josh Owens

unread,
Mar 11, 2014, 2:12:23 PM3/11/14
to cincin...@googlegroups.com, Bill Barnett
rbenv rehash?  Any time you install a global gem that has an executable, you need to have it re-search your path and whatnot.  I may not be explaining that 100% right without diving into the rbenv internals.  Use meteor and npm, less issues ;)
--
Josh Owens | 513-678-7081@joshowens

Chris Moore

unread,
Mar 11, 2014, 2:13:46 PM3/11/14
to cincin...@googlegroups.com
Nope, it's not rbenv. It's the local bin folder. Doug says `hash -r` would update the lookup cache and achieve the same result.
--
Thanks,
Chris

Josh Owens

unread,
Mar 11, 2014, 2:15:57 PM3/11/14
to cincin...@googlegroups.com, Chris Moore
It is rbenv, see below in the first error.  rbenv rehash does the same thing as hash -r, I believe.
--
Josh Owens | 513-678-7081@joshowens

Doug Alcorn

unread,
Mar 11, 2014, 2:35:35 PM3/11/14
to cincin...@googlegroups.com
What's interesting is that rbenv is recreating the shims based on what binstubs it thinks it needs for _any_ of it's versions. The trick is to not remove the shim, but the version's tracking of the bin:

find ~/.rbenv/versions/*/bin -name 'rails' | xargs rm

Then you can use 'rbenv rehash'. I have the same problem the heroku script as well. If you don't delete the file from the versions/*/bin directory then `rbenv rehash` will just recreate the shim.


--

---
You received this message because you are subscribed to the Google Groups "Cincinnati.rb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cincinnatirb...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Doug Alcorn
(513) 295-2844
Reply all
Reply to author
Forward
0 new messages