Project

macos

0.0
A long-lived project that still receives updates
An interface (designed for LLMs) to macOS.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 0
>= 0
 Project Readme

MacOS

LICENSE RubyGems GitHub Yard CircleCI

A library for interacting with your Mac through ruby.

Installation

gem install macos

Usage

Mouse

require 'macos'

mouse = MacOS.mouse

mouse.move(x: 0, y: 0)
position = mouse.position
puts "#{position.x},#{position.y}"

mouse.move(x: 2, y: 3)
position = mouse.position
puts "#{position.x},#{position.y}"

Display

require 'macos'

display = MacOS.display
bounds = display.bounds

puts "#{bounds.width}×#{bounds.height}"

display.screenshot do |tempfile|
  # ...
end