Dsymutil is not being found but I can't specfy where it actually is

I’m running on MacOS 13.5.2, but started old and has been upgraded through the years (don’t know if that’s relevant but it might be). I’ve just installed crystal first via asdf and then, after that didn’t work, via homebrew.

In both cases, I’ve been trying to run a simple puts "Hello, world" via crystal hello.cr (and, later, via crystal eval 'puts "Hello, World"'). However, I keep getting this error:

Unable to get file info: '/usr/local/bin/dsymutil': Permission denied (File::AccessDeniedError)
  from /opt/homebrew/Cellar/crystal/1.9.2/bin/crystal in 'raise<File::Error+>:NoReturn'
  from /opt/homebrew/Cellar/crystal/1.9.2/bin/crystal in 'Crystal::System::File::info?<String, Bool>:(File::Info | Nil)'
  from /opt/homebrew/Cellar/crystal/1.9.2/bin/crystal in 'Process::file_executable?<Path>:Bool'
  from /opt/homebrew/Cellar/crystal/1.9.2/bin/crystal in 'Process::find_executable<String>:(String | Nil)'
  from /opt/homebrew/Cellar/crystal/1.9.2/bin/crystal in 'Crystal::Compiler#codegen<Crystal::Program, Crystal::ASTNode+, Array(Crystal::Compiler::Source), String>:(Tuple(Array(Crystal::Compiler::CompilationUnit), Array(String)) | Nil)'
  from /opt/homebrew/Cellar/crystal/1.9.2/bin/crystal in 'Crystal::Compiler#compile:combine_rpath<Array(Crystal::Compiler::Source), String, Bool>:Crystal::Compiler::Result'
  from /opt/homebrew/Cellar/crystal/1.9.2/bin/crystal in 'Crystal::Compiler#compile:combine_rpath<Array(Crystal::Compiler::Source), String, Bool>:Crystal::Compiler::Result'
  from /opt/homebrew/Cellar/crystal/1.9.2/bin/crystal in 'Crystal::Command#eval:NoReturn'
  from /opt/homebrew/Cellar/crystal/1.9.2/bin/crystal in '__crystal_main'
  from /opt/homebrew/Cellar/crystal/1.9.2/bin/crystal in 'main'
Error: you've found a bug in the Crystal compiler. Please open an issue, including source code that will allow us to reproduce the bug: https://github.com/crystal-lang/crystal/issues

Now, I know that dsymutil does not live in /usr/local/bin. It lives in /usr/bin. I see /usr/local/bin in my PATH but nowhere else in my environment variables. I don’t see it anywhere in homebrew’s Formula. I don’t know where this is being specified. The question is twofold:

  1. Why is crystal assuming it lives in /usr/local/bin instead of trying to locate?
  2. How can I change this assumption?

I think is failing because it tries to check if /usr/local/bin/dsymutil exists at all and failing in that check.

If you drop or tweak the order in PATH you should get pass this I think.

That being said, maybe Process.file_executable? should not raise in this case. Is there anything to say regarding the permissions on that folder?

The actual exception comes from Crystal::System::File.info? which by its very definition shouldn’t raise an exception. Looking at its implementation confirms this, and Crystal::System::File.info just wraps it and re-raises an exception.

Being unable to stat /usr/local/bin also doesn’t sound unusual to me as that’s generally a protected directory, but that makes me wonder how this issue hasn’t crept up before on MacOS when running anything with debug. :thinking:

Ok, so running PATH=/usr/bin:$PATH crystal eval 'puts "Hello, World"' works, which is good to know.

But it does feel odd to have /usr/bin higher in the PATH than /usr/local/bin. Though, I guess, since I know basically nothing is using /usr/local/bin, it should be fine to muck around with the default PATH building in my shell. Ah, well. Thank you both for the answer!