Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

File.executable_real?

File.executable_real?(file_name) → true or false

Returns true if the named file is executable by the real user and group id of this process. See access(3).

Windows does not support execute permissions separately from read permissions. On Windows, a file is only considered executable if it ends in .bat, .cmd, .com, or .exe.

Note that some OS-level security features may cause this to return true even though the file is not executable by the real user/group.

See also .executable? .exist? .empty? .expand_path also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0