0

Per my school's instructions, I'm using VSCode and a bash shell; whenever I try to "run active file in active terminal", it returns "permission denied".

screenshot of editor and terminal

Like I said above, I'm using a bash shell - although I just updated from Mac's Sierra to Catalina and am being prompted that the default shell on Mac's OS is now zsh. I don't know if maybe that's why the terminal isn't working properly. Before I had updated to Catalina, it was working perfectly! I only recently started classes and I don't even know the difference between bash or zsh or what code editors are great and which are wonky. How do I fix this?

cottontail
  • 10,268
  • 18
  • 50
  • 51
aber
  • 1
  • 1
  • 2
  • https://emacs.stackexchange.com/questions/53026/how-to-restore-file-system-access-in-macos-catalina – β.εηοιτ.βε Mar 17 '20 at 23:04
  • `.rb` files are not executable, they need an interpreter to execute them. Pass the `.rb` file as argument to `ruby` (the interpreter). – axiac Mar 17 '20 at 23:06
  • thank for answering, folks! β.εηοιτ.βε, I tried doing what the post said but it didn't work. axiac, when I write "ruby [file name].rb", it does work! However, I just started learning TDD and when I try to test something that is meant to return "nil" or "false" or "true", it only returns a blank line? – aber Mar 17 '20 at 23:28
  • @aber : You try to run your Ruby program as bash program. This can't work! I suggest that you add to your program a `!#` line for Ruby, and set the x-bit on the file, so that it is understood as executable. – user1934428 Mar 18 '20 at 15:41

1 Answers1

1

Try to launch VS Code in root mode ? Maybe that's the issue? So sudo code . in the directory should open it in root mode.

JamesDev
  • 139
  • 1
  • 1
  • 7
  • Thanks for answering! It opened it in root mode and I tried another file with another terminal but it still says Permission Denied :/ – aber Mar 17 '20 at 23:27
  • Interesting.. I don't really know what to tell ya. Have you tried running the file by hand ? Calling the ruby command ? – JamesDev Mar 17 '20 at 23:34
  • Yes: I have found that it runs okay except when I'm asking for it to return "nil", "false", or "true" which I'm needing right now for my lessons on TDD. – aber Mar 17 '20 at 23:46