Module: ClaudeAgentSDK::CLIInstaller::Platform

Defined in:
lib/claude_agent_sdk/cli_installer.rb

Overview

Maps the running Ruby to a release-manifest platform key (darwin-arm64, darwin-x64, linux-x64, linux-arm64, and the -musl variants). Windows is not supported by this gem.

Class Method Summary collapse

Class Method Details

.detectObject



61
62
63
64
65
66
67
68
69
70
# File 'lib/claude_agent_sdk/cli_installer.rb', line 61

def detect
  target = ruby_platform.to_s.downcase
  os = detect_os(target)
  arch = detect_arch(target)
  # A Ruby built for x86_64 running under Rosetta 2 reports darwin-x64,
  # but the machine is arm64 — install the native binary.
  arch = 'arm64' if os == 'darwin' && arch == 'x64' && rosetta?
  suffix = os == 'linux' && target.include?('musl') ? '-musl' : ''
  "#{os}-#{arch}#{suffix}"
end