0

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?

sebkkom
  • 1,426
  • 17
  • 31
  • 1
    try `which ruby` and then symlink that to where rails is looking (`/usr/local/opt/ruby/bin/ruby`) – max pleaner Aug 01 '16 at 23:12
  • or maybe http://stackoverflow.com/questions/7907055/bash-usr-local-bin-heroku-usr-local-bin-ruby-bad-interpreter-no-such-file – Brad Werth Aug 01 '16 at 23:15
  • Try following [this blog](http://railsapps.github.io/installrubyonrails-mac.html), it helped me to setup rails after so many failures. Just skip the steps if you have already done it. – Sahil Aug 01 '16 at 23:51
  • You can get rails installed to this location like this: `sudo gem install -n /usr/local/bin/ rails ` – Bijoy Thangaraj Feb 25 '20 at 06:16

1 Answers1

0

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!

sebkkom
  • 1,426
  • 17
  • 31