Search code examples
ruby-on-railsrubymacoshomebrewrbenv

Can't install Rails on El Capitan


DISCLAIMER: I am on a machine where numerous things have most probably been installed, uninstalled, moved around and/or somehow modified so I can't really provide a lot of information on what has happened before I got my hands on it. I would be more than grateful, however, to use this situation as an opportunity to better understand how all these tools work so please don't hesitate to answer even with steps I could probably follow to solve the problem I have.

Short Version:

rbenv is used for ruby and the current installed version is 2.3.0

brew -v outputs Homebrew 0.9.9 (no git repository) Homebrew/homebrew-core (git revision 8427; last commit 2016-08-01)

The latest version of Xcode is installed and gcc outputs

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1 Apple LLVM version 7.3.0 (clang-703.0.31) Target: x86_64-apple-darwin15.6.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Now, I (suppossedly) "install" rails

(gem install rails outputs Successfully installed rails-5.0.0 1 gem installed)

but straight after that rails -v outputs -bash: /usr/local/bin/rails: /usr/local/opt/ruby/bin/ruby: bad interpreter: No such file or directory

Is there maybe some way to do a clean uninstall and install of all the aforementioned tools?


Solution

  • As per your suggestions to look in those other questions and after some more digging, I ended up limiting the error to Not a directory which led me to an rbenv issue that pointed me to the possibility of having /usr/local/bin at the head of my PATH after initializing rbenv. And, as jeremy writes, that's why invoking rails is finding the executable in /usr/local/bin/ instead of in /Users/michelfrechette/.rbenv/shims/. So I removed that line and problem solved!