Set up a local development environment for Temporal and Ruby

Introduction
Follow these instructions to configure a development environment for building Temporal Applications with Ruby.
The Temporal Ruby SDK is only supported on macOS ARM/x64 and Linux ARM/x64. and the platform-specific gem chosen is based on when the gem/bundle install is performed. A source gem is published but cannot be used directly and will fail to build if tried. MinGW-based Windows is not currently supported. There are caveats with the Google Protobuf dependency on musl-based Linux. See the Platform Support section for more information.
Install Ruby
Make sure you have Ruby installed. These tutorials use Ruby 3.4.3.
Check your version of Ruby with the following command:
ruby -v
You'll see the version printed to the screen, along with other data about the version and system architecture:
ruby 3.4.3 ...
Install the Temporal Ruby SDK
You should install the Temporal Ruby SDK in your project using a virtual environment.
Create a directory for your Temporal project:
mkdir temporal-project
Switch to the new directory:
cd temporal-project
Create the Gemfile using Bundler:
bundle init
Add the Temporal SDK to the Gemfile:
bundle add temporalio
You'll see an output similar to the following:
Fetching gem metadata from https://rubygems.org/.....
Resolving dependencies...
Next, install the Temporal SDK from the Gemfile:
bundle install
You'll see an output similar to the following:
Installing temporalio 0.4.0 (arm64-darwin)
Bundle complete! 1 Gemfile dependency, 6 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Next, you'll configure a local Temporal Service for development.
Set up a local Temporal Service for development with Temporal CLI
The fastest way to get a development version of the Temporal Service running on your local machine is to use Temporal CLI.
Temporal CLI is a tool for interacting with the Temporal Service from the command-line interface. It includes a self-contained distribution of the Temporal Service and Web UI as well which you can use for local development.
Install Temporal CLI on your local machine using the following instructions for your platform.
- macOS
- Windows
- Linux
You can install the latest version with Homebrew using the following command:
brew install temporal
To install Temporal CLI on Windows, download the version for your architecture:
Once you've downloaded the file, extract the downloaded archive and add the temporal.exe
binary to your PATH
.
To install Temporal CLI, download the version for your architecture
Once you've downloaded the file, extract the downloaded archive and add the temporal
binary to your PATH
by copying it to a directory like /usr/local/bin
.
Once you've installed Temporal CLI and added it to your PATH
, open a new Terminal window and run the following command:
temporal server start-dev
This command starts a local Temporal Service. It starts the Web UI, creates the default Namespace, and uses an in-memory database.
- The Temporal Service will be available on
localhost:7233
. - The Temporal Web UI will be available at
http://localhost:8233
.
Leave the local Temporal Service running as you work through tutorials and other projects. You can stop the Temporal Service at any time by pressing CTRL+C
.
The Temporal Web UI may be on a different port in some examples or tutorials. To change the port for the Web UI, use the --ui-port
option when starting the server:
temporal server start-dev --ui-port 8080
The Temporal Web UI will now be available at http://localhost:8080
.
The temporal server start-dev
command uses an in-memory database, so stopping the server will erase all your Workflows and all your Task Queues. If you want to retain those between runs, start the server and specify a database filename using the --db-filename
option, like this:
temporal server start-dev --db-filename your_temporal.db
When you stop and restart the Temporal Service and specify the same filename again, your Workflows and other information will be available.
Once you have everything installed, you're ready to build Temporal Applications with Ruby on your local machine.