Skip to content

Instantly share code, notes, and snippets.

@komagata

komagata/symapps.rb

Created Jun 29, 2011
Embed
What would you like to do?
Make symlink from Mac GUI Apps.
#!/usr/bin/env ruby
require 'fileutils'
def e(path) path.gsub(/[ ()]/) {|s| "\\#{s}"} end
FileUtils.rm_rf("#{ENV['HOME']}/.macapp")
FileUtils.mkdir("#{ENV['HOME']}/.macapp")
Dir.glob('/Applications/{,Utilities/}*.app') do |path|
script = "#{ENV['HOME']}/.macapp/#{path.split('/').last}"
open(script, 'w') {|f| f.write(<<-EOS) }
#!/bin/sh
open -a #{e(path)}
EOS
FileUtils.chmod(0755, script)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.