---
title: "Change Ruby version for single command with rbenv"
description: "You can switch Ruby version temporarily with rbenv local"
canonical: https://oozou.com/til/change-ruby-version-for-single-command-with-rbenv-68
locale: en
date: 2020-10-13
topic: ruby
---

# Change Ruby version for single command with rbenv

> You can switch Ruby version temporarily with rbenv local

Published: 2020-10-13 · Topic: [ruby](https://oozou.com/til-topics/ruby) ([markdown](https://oozou.com/til-topics/ruby.md))

You can switch Ruby version temporarily with *rbenv local*

But it'd need to be switched back after you're done. Specially for a single command it's kind of pain. In those cases, you can use *RBENV\_VERSION* env variable.

```
RBENV_VERSION=2.6.3 ruby -v
```

This might be useful in a shell script or so.

---

Contact OOZOU: hello@oozou.com · +66 2544 0000 · https://oozou.com/contact

More for AI agents: https://oozou.com/llms.txt · every page has a markdown twin at its URL plus ".md"
