0

My ruby ​​version is 2.3.0, my mysql version is 8.0.23, my mysql2 version is 0.5.3, my rails version is 5.0.7.2, and my Xcode version is 12.5.

I use macOS Big Sur(version 11.4) and the text editor "Atom".

I'm planning to release my Rails application with the URL of HEROKU(example. https://[My APP Name].herokuapp.com).

I ran the following command.

$ bundle exec rake secret

bash: /usr/local/bin/bundle: /System/Library/Frameworks/Ruby.framework/Versions/2.3/
usr/bin/ruby: bad interpreter: No such file or directory

I installed the ruby version "2.3.0" as below ,because bundle seems to call "2.3".

$ rbenv install 2.3.0

Downloading openssl-1.0.2u.tar.gz...
-> https://****
Installing openssl-1.0.2u...
Installed openssl-1.0.2u to /Users/****/.rbenv/versions/2.3.0

Downloading ruby-2.3.0.tar.bz2...

-> https://****
Installing ruby-2.3.0...

WARNING: ruby-2.3.0 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.

ruby-build: using readline from homebrew
Installed ruby-2.3.0 to /Users/****/.rbenv/versions/2.3.0

I verified that the ruby version "2.3.0" is installed and the current ruby version is "2.3.0".

$ rbenv local 2.3.0
$ rbenv rehash
$ rbenv versions
  
  system
* 2.3.0
$ rbenv global 2.3.0
$ rbenv rehash
$ rbenv versions

  system
* 2.3.0

But the ruby current version is "2.6.3" when used the below command.

$ ruby -v

ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]
$ gem env

RubyGems Environment:
  - RUBYGEMS VERSION: 3.0.3
  - RUBY VERSION: 2.6.3 (2019-04-16 patchlevel 62) [universal.x86_64-darwin20]
  - INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.6.0
  - USER INSTALLATION DIRECTORY: /Users/****/.gem/ruby/2.6.0

  - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
  - GIT EXECUTABLE: /usr/local/bin/git
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - SPEC CACHE DIRECTORY: /Users/****/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-20
  - GEM PATHS:
     - /Library/Ruby/Gems/2.6.0
     - /Users/****/.gem/ruby/2.6.0
     - /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /Users/****/.rbenv/shims

I ran the following command.

$ bundle exec rake secret

bash: /usr/local/bin/bundle: /System/Library/Frameworks/Ruby.framework/Versions/2.3/
usr/bin/ruby: bad interpreter: No such file or directory

Would you like to tell me how to get rid of /usr/local/bin/bundle? Because my bundle exec should work if I can get rid of /usr/local/bin/bundle.

And should I reinstall the Xcode ,that is command line tools? The 1st answer of the below URL recommends to try running xcode-select --install to (re)install the Xcode command line tools.

Cannot install Jekyll after updating to Catalina - An error occurred while installing ffi (1.9.18)

Marchan4
  • 35
  • 1
  • 6

1 Answers1

0

Looks like your /usr/local/bin/bundle precedes the bundle executable from rbenv in your PATH.

Could it be that you installed ruby with some other tools than rbenv (additionally to rbenv installation)?

In my macOS setup i do not have a file /usr/local/bin/bundle

$ ls /usr/local/bin/bundle
ls: /usr/local/bin/bundle: No such file or directory

and the bundle executable is loaded from my rbenv installation:

$ which bundle
/Users/***/.rbenv/shims/bundle

I think, if you can get rid of /usr/local/bin/bundle your bundle exec could work.

(you could try this with renaming the /usr/local/bin/bundle temporary, if you do not know how this bundle file was installed on your system)

  • I executed the following command. What does this command mean? `$ ls /usr/local/bin/bundle /usr/local/bin/bundle` – Marchan4 Aug 23 '21 at 09:44
  • there is a file `bundle` in your systems, additionally to the `bundle` from rbenv (which is located in `/Users/***/.rbenv/shims` See the rest of my answer - if you manage to get rid of the file in `/usr/local/bin` your rbenv-bundle should be executed. You could also change your `$PATH`, but personally i would prefer to just remove the file in `/usr/local/bin` – Armin Schreger Aug 23 '21 at 12:34
  • What's the command to get rid of the file `bundle` in `/usr/local/bin/bundle`? – Marchan4 Aug 25 '21 at 05:16