You can run which ruby to find out where the ruby ββwill look if you type ruby in the terminal.
If you want to find additional information about the artist, you can run:
$ ls -l $(which ruby) lrwxr-xr-x 1 root wheel 76 Nov 8 12:56 /usr/bin/ruby -> ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby
That is, run which ruby and pass the results of this to ls -l , which will show you that this is actually a symbolic link to the binary in the Ruby structure. You can also use file to find out which file it has:
$ file $(which ruby) /usr/bin/ruby: Mach-O universal binary with 2 architectures /usr/bin/ruby (for architecture x86_64): Mach-O 64-bit executable x86_64 /usr/bin/ruby (for architecture i386): Mach-O executable i386
If you want to make sure that you are executing a ruby ββthat is in the user's path from the script, instead of hardcoding, where Ruby is, you can use the following interpreter directive at the top of your script:
#!/usr/bin/env ruby
This works because almost all modern systems have an executable in /usr/bin/env that will execute a utility that you pass to it based on your path; so instead of hardcoding /usr/bin/ruby in your script, you can let env look for your path for you.
Brian campbell
source share