To search for and buy Twilio phone numbers with Ruby, start by installing the twilio-ruby gem and opening an interactive Ruby shell (irb or pry). Authenticate with your Twilio account credentials to create an API client. Search for available phone numbers in a specific country (e.g. "GB" for the UK) using the `available_phone_numbers` method, and filter results by keyword (e.g. "4420" for London numbers). Once you find a desired number, use the `create` method to buy it and add TwiML Bin behavior to configure incoming calls or SMS messages with URLs that return custom responses.