Script: Finder/Make Executable

  • Script: Make Executable
  • Application: Finder
  • Suggested key binding: ⇧⌘X

Peek:

finder      = Appscript::app("Finder")
paths       = finder.selection.get(:result_type => :alias).map(&:path)
file_paths  = paths.select { |path| File.file? path }
chmod_flags = ARGV[0] || "ugo+x"
system "chmod", chmod_flags, *file_paths unless file_paths.empty?

While you can change the read/write permissions for a file from the Finder via the Get Info pane, the execute permission is nowhere to be found.

This script hopes to mend that. It sets the executable bits for the selected files in the Finder. It does not affect the existing read/write permissions. (I.e., it calls chmod ugo+x.)


Today’s script comes with a free counterpart, Make Not Executable, which I suggest you bind to ⌥⌘X.

It simply piggybacks on the former, passing a parameter that modifies what is passed down to chmod:

system Pathname.new(__FILE__).dirname.realpath.join("Make Executable.rb").to_s, "ugo-x"

Get the standalone script files for Make Executable and for Make Not Executable, or git pull if you’re keeping a git clone of the scripts.

This post of part of series on the scripts I use with FastScripts.

Got comments? Use reddit and/or poke me on twitter.