class Rebuild::CommandLineTools

Constants

DATABASE
SUPPORTED_TERMINALS

Public Class Methods

install() click to toggle source
# File lib/rebuild/command_line_tools.rb, line 16
def install
  obtain_accesibility

  Logger.info('Running command line tools installation...')
  `xcode-select --install`

  Script.execute_scpt('start_install')
  sleep 5 until installed?
  Script.execute_scpt('click_done')
  Logger.finish('Finished to install command line tools')
end
installed?() click to toggle source
# File lib/rebuild/command_line_tools.rb, line 12
def installed?
  system('xcode-select -p > /dev/null 2>&1')
end

Private Class Methods

obtain_accesibility() click to toggle source

Enable Security & Privacy > Privacy > Accessibility for Terminal.app.

# File lib/rebuild/command_line_tools.rb, line 31
      def obtain_accesibility
        Logger.info('Obtained accessibility for terminal to click buttons')

        SUPPORTED_TERMINALS.each do |bundle_identifier|
          sql = <<-SQL
            INSERT OR REPLACE INTO access
            VALUES('kTCCServiceAccessibility','#{bundle_identifier}',0,1,0,NULL);
          SQL
          `sudo sqlite3 #{DATABASE} "#{sql}"`
        end
      end