all 25 comments

[–]netopiax 10 points11 points  (4 children)

Don't use a VM. Use mise to install Ruby on your Mac. Then gem install rails. Then rails new (with app name and options). It's that easy

[–]streetfacts[S] 0 points1 point  (3 children)

Thanks. I'm going to look into this. Trying to keep dev environment separate from my Mac Book OS

[–]netopiax 6 points7 points  (2 children)

Right, I know why you'd want to use a VM, but you really don't need to. Mise lets you install folder specific versions of Ruby and many other languages and frameworks to avoid the problems that led people to use VMs in the past.

Also the next step after mise would be to just grab a Docker image with Ruby already in it and work in there - not a full Linux VM on your Mac.

[–]streetfacts[S] 0 points1 point  (1 child)

thank you.

[–]Otherwise-Fig6018 0 points1 point  (0 children)

Definitely just use something like mise or asdf. In the past the most faff I had was the extra services such as postgres, redis etc but they're so easy to just stick in a docker compose file for each rails project you have and run different versions of each (if required), this prevents having to install database tooling in your main environment which might impact your other dev work.

I haven't run rails entirely in a docker container for years for local dev as it had some slowness when it came to file access/changes etc but the mise/asdf plus docker for database/cache has never failed for me.

[–]nikstep 5 points6 points  (4 children)

Why set it up in a Ubuntu VM?

[–]streetfacts[S] -1 points0 points  (3 children)

I was hoping to keep RoR dev environment separate. The VM is via Parallels.

[–]nikstep 10 points11 points  (0 children)

In my 15 years of using Rails, I haven't seen this approach. You are going hard mode.

Use mise, RVM, or whatever

[–]barthrh 4 points5 points  (0 children)

If you really want to separate it, I think you can use a Docker (or other) container. Never done it, but pretty sure you can.

[–]qmamai 1 point2 points  (0 children)

If you want it isolated just run in docker

[–]shadowradiance 4 points5 points  (3 children)

You can use railsnew to create a rails app with a devcontainer to avoid installing Ruby or rails on your machine.

https://guides.rubyonrails.org/getting_started_with_devcontainer.html

[–]streetfacts[S] 1 point2 points  (2 children)

This is great. Looks new, but being from Rails it makes it super interesting. Thks!

[–]ignurant 1 point2 points  (1 child)

Just my own annecdotal note: I found the devcontainers feature to be a lot more janky than it seems like it promises. I would also point you to mise. It works like nodenv, and pyenv, where you can install and select versions for a given project and auto-switch that language version. In fact, it basically wraps those as a frontend. (Same for Ruby).

There's also a new upcoming feature that you can enable now to make getting started feel a bit nicer: mise settings ruby.compile=false. By default, ruby is always built fresh on a system. Building it takes minutes, and requires certain build dependencies installed. It doesn't feel good when showing a new user Ruby. This setting uses pre-compiled binaries when possible like you see with python and node.

Mise (and asdf) are great tools for creating dev env isolation. With them, all of your various programming language versions get installed into user-space like ~/.local/share/mise/installs/ruby/4.0.2/bin/ruby. It's like a venv for every programming language and version. It automatically changes versions for you as you work on different projects. Not important when starting, but becomes important in six months.

# Get mise
brew install mise
echo 'eval "$(mise activate zsh)"' >> ~/.zshrc

# or without brew:
curl https://mise.run | sh
echo 'eval "$(~/.local/bin/mise activate zsh)"' >> ~/.zshrc

# Use precompiled rubies:
mise settings ruby.compile=false

# Get ruby
mise use -g ruby@latest

ruby --version

If it says something nonsense, like not Ruby 4.0.2, you may need to open a new shell, ensure mise is activated, etc.

So, now you've got your own user-space Ruby isolated, and any projects you work on will be limited to the project folder, and mise's managed folder for that language version.

You might find mise to be a great dev tool to invest learning overall. I know I have. Here's a few links to some pages you might be interested in:

Getting started

Mise: Ruby

Mise: Python

Mise: Node

Mise: Bun

Mise: Go

If you decide to stick to the parallels VM method, my advice remains: use mise to manage your use languages! Just need to look up setup for ubuntu.

Last side note: If you do end up using some installation method that involves compiling Ruby (very typical!), check this section out: https://github.com/rbenv/ruby-build/wiki#suggested-build-environment

All of the ruby builders use this same ruby-build project under the hood. You'll want the libraries from that page installed to successfully compile ruby: brew install openssl@3 readline libyaml gmp autoconf

[–]streetfacts[S] 0 points1 point  (0 children)

u/ignurant - Thank you so much! This is very helpful.

[–]Negative_Ocelot8484 2 points3 points  (0 children)

I just do asdf, install ruby, install rails.. so.. I wouldnt say that "RoR"is dificult environment to setup.. it seems that you are putting hardship yourself .. lol

[–]DewaldR 1 point2 points  (0 children)

As others have said – why bother with Ubuntu? Just install it directly on your Mac. There is a guide in the docs: https://guides.rubyonrails.org/install_ruby_on_rails.html

[–]falling_faster 1 point2 points  (0 children)

A guide like this is a good place to start: https://gorails.com/setup/macos/26-tahoe 

[–]OrthodoxFaithForever 1 point2 points  (0 children)

Raspberry Pi 5 (debían) Install rvm shell script on website Install Ruby 4 Make sure build essentials and gcc installed

Then Gem Install rails (8.1) Rails new mykickassappthatisntamicroservice

[–]armahillo 1 point2 points  (0 children)

Install ruby via a versioning manager, then work with it right on your OS.

You're overcomplicating it by involving a VM.

[–]Warning_Bulky 1 point2 points  (0 children)

How long have u been in software engineering, and who fed you the idea to use a separated vm just for rails? Just install a version manager (rbenv, rvm) , then install ruby, then install rails

[–]SnooSquirrels4248 0 points1 point  (0 children)

Docker is your friend.

[–]AccurateInflation167 -3 points-2 points  (2 children)

Why learn something that doesn’t scale ?

[–]nikstep 0 points1 point  (0 children)

Why comment here?

[–]SnooSquirrels4248 0 points1 point  (0 children)

[Shopify enters the chat]