dtan4 / terraforming

Export existing AWS resources to Terraform style (tf, tfstate) / No longer actively maintained
http://terraforming.dtan4.net/
MIT License
4.3k stars 657 forks source link

ruby: bad interpreter: No such file or directory #486

Open FernandoMiguel opened 4 years ago

FernandoMiguel commented 4 years ago
$ terraforming r53r --tfstate
/usr/local/bin/terraforming: /usr/local/Cellar/terraforming/0.18.0/libexec/bin/terraforming: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/terraforming: line 2: /usr/local/Cellar/terraforming/0.18.0/libexec/bin/terraforming: Undefined error: 0

ProductName: Mac OS X ProductVersion: 10.15.1 BuildVersion: 19B68f

$ brew --version Homebrew 2.1.14 Homebrew/homebrew-core (git revision 3592; last commit 2019-10-15) Homebrew/homebrew-cask (git revision 6746e7; last commit 2019-10-15)

FernandoMiguel commented 4 years ago

@chenrui333 not sure you can help here?

mklatsky commented 4 years ago

I have this issue as well: ProductName: Mac OS X ProductVersion: 10.15 BuildVersion: 19A602

brew --version Homebrew 2.2.0 Homebrew/homebrew-core (git revision bd9f90; last commit 2019-12-06) Homebrew/homebrew-cask (git revision b10c3; last commit 2019-12-06)

$ terraforming s3 /usr/local/bin/terraforming: /usr/local/Cellar/terraforming/0.18.0/libexec/bin/terraforming: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory /usr/local/bin/terraforming: line 2: /usr/local/Cellar/terraforming/0.18.0/libexec/bin/terraforming: Undefined error: 0

NOTE: Editing /usr/local/Cellar/terraforming/0.18.0/libexec/bin/terraforming, changing first line from #!/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby to #!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby solved the issue in the short term. However, I suspect this would be overwritten when an upgrade is performed.

chenrui333 commented 4 years ago

Sure, I can take a look.

chenrui333 commented 4 years ago

I have just done the fresh installation and run the terraforming r53r --tfstate, it works well for me.

chenrui333 commented 4 years ago

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

that looks like a familiar issue to me.

chenrui333 commented 4 years ago

can you run brew reinstall terraforming to see if it works?

this error might be due to the OS upgrade.

mklatsky commented 4 years ago

I just performed a brew remove terraforming and then a subsequent brew install terraforming and it is working. When I look in /usr/local/Cellar/terraforming/0.18.0/libexec/bin/terraforming, I see that the first line points to the 2.6 version of ruby: #!/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby. I suspect this might break at some point. Would it make sense to always point to "Current"?

The contents of the /System/Library/Frameworks/Ruby.framework/Versions/ dir is:

$ ls -al /System/Library/Frameworks/Ruby.framework/Versions/
total 0
drwxr-xr-x  4 root  wheel  128 Oct 12 09:55 .
drwxr-xr-x  5 root  wheel  160 Oct 12 09:55 ..
drwxr-xr-x  6 root  wheel  192 Sep 29 16:29 2.6
lrwxr-xr-x  1 root  wheel    3 Oct 12 09:52 Current -> 2.6
chenrui333 commented 4 years ago

/System/Library/Frameworks/Ruby.framework/Versions/ that is MacOS default ruby installation though (ruby 2.6 on Catalina OS). I think for every MacOS upgrade, it (homebrew stuff) might be broken.

I had the similar issue before and after remove ruby symlink (that is why I feel like I saw this earlier), it started working for me. :)

Sakshi1305 commented 2 years ago

I have faced the similar issue due to ruby version not set. These are the steps that I have followed:

Check rbenv versions in your system by this command:

rbenv versions

if not then installed and set local or globally as per need by command:

rbenv local 2.6.6

the output of rbenv versions command like this-

* system (set by /Users/sakshijain/.rbenv/version)
  2.3.7
  2.4.0
  2.5.0
  2.6.3
  2.6.5
  2.6.6