---
title: "TIL: Ruby的版本管理和虚拟环境配置"
url: "https://versun.me/til-ruby-version-and-env"
markdown_url: "https://versun.me/til-ruby-version-and-env.md"
format: "note"
published: "2025-01-03T14:52:52.000Z"
updated: "2026-01-05T05:29:32.000Z"
collections:
  - "Blog"
site: "Versun"
---

# TIL: Ruby的版本管理和虚拟环境配置

使用mise来安装不同版本的ruby，类似Python中的uv工具

使用bundler来控制不同项目的gem包版本，类似Python中的pip

在项目文件夹中运行命令`bundle config set --local path 'vendor/bundle'`，会在文件夹中创建`.bundle/config`配置文件，并指定gem的安装包路径为`vendor/bundle`，类似Python中的virtualenv创建隔离的虚拟环境
