Rediger

Del via


Step 1: Configure development environment for Ruby development

Configure your development environment with the prerequisites to develop an application by using the Ruby Driver for SQL Server.

The Ruby Driver uses the TDS protocol, which is enabled by default in SQL Server and Azure SQL Database. No additional configuration is required.

Windows

  1. Download Ruby Installer If your machine doesn't have Ruby, install it. Go to the Ruby download page and download the latest Ruby+Devkit installer for your architecture (x64 or x86). For example, download Ruby+Devkit 3.2.x (x64).

  2. Install Ruby Run the installer:

    1. Select your language, and agree to the terms.
    2. On the install settings screen, select the check boxes next to both Add Ruby executables to your PATH and Associate .rb and .rbw files with this Ruby installation.
    3. After installation, the MSYS2 setup dialog appears. Select option 3 (MSYS2 and MINGW development toolchain) and press Enter to install the build tools.
  3. Open a new command prompt

  4. Install TinyTDS gem

    gem install tiny_tds
    

Note

Previous versions of Ruby (2.x) required a separate DevKit download and dk.rb init / dk.rb install commands. Ruby 3.0 and later versions include the MSYS2 DevKit in the installer, so separate DevKit setup is no longer required.

Ubuntu Linux

  1. Open terminal

  2. Install Ruby and prerequisites

    sudo apt-get update
    sudo apt-get install -y ruby-full build-essential
    
  3. Verify Ruby installation

    ruby -v
    
  4. Install FreeTDS

    sudo apt-get install -y freetds-dev freetds-bin
    
  5. Install TinyTDS

    gem install tiny_tds
    

macOS

macOS includes a system Ruby installation, but for best results, install a current version by using Homebrew.

  1. Open terminal

  2. Install Homebrew package manager

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
  3. Install Ruby (optional, if you need a newer version than the system Ruby)

    brew install ruby
    
  4. Install FreeTDS

    brew install FreeTDS
    
  5. Install TinyTDS gem

    gem install tiny_tds