![]() Open a new terminal window so that you have the new rbenv environment loaded If so, you can run the rbenv-doctor tool that the rbenv GitHub project provides: You might want to run some diagnostic checks to ensure that everything is set up correctly. The rbenv install process is now complete. Run the following command in your terminal: ![]() Just like many other tools, we turn to the popular Homebrew macOS package manager. The open source rbenv project is hosted on GitHub, and a great place for working through issues and getting up-to-date documentation from the rbenv README. Other Ruby virtual environment managers that I haven’t explored, yet are worth noting, are chruby and ruby-install. Instead, I asked some Ruby-savvy developer friends for their opinion, and went with rbenv since the majority of them recommended it. Since specific environment tools and versions tend to become outdated as the industry progresses, I won’t go into a detailed feature matrix comparison of rbenv vs rvm1. Two popular Ruby virtual environments tools are rbenv and rvm. They are essentially Ruby version manager that allows you to quickly switch between different Ruby runtime versions as needed, depending on the Ruby install directory that was set. They then instruct you to add this new directory path onto your shell of choice, so the new Ruby version is available to use when you open new terminal interfaces. These tools avoid conflicting with the native Ruby Mac version by fetching the Ruby source code from the internet, compiling it locally, and making it available under a path. All you need to get started are a few Ruby ecosystem tools, such as rbenv or rvm. If you’ve used Python’s virtualenv or Node.js’s nvm, then Ruby’s virutalenv should be an easy switch. The Ruby virtual environmentĪ great concept that is familiar with other programming languages and their tooling is the Ruby virtual environment. Instead, consider installing a Ruby virtual environment with a tool like rbenv. Ruby gems are installed and managed natively on macOS by the operating system, and using sudo gem install or making changes in those Ruby gems is discouraged. The Ruby interpreter is often found natively on the macOS in the file paths /usr/bin/ruby or /usr/local/bin/ruby, depending on where it was installed. Sometimes, you may also find Ruby in the file path /usr/local/bin/ruby when it is installed with Homebrew package manager for macOS. If you’ve upgraded, or manage Ruby versions using rbenv, rvm, or other Ruby version managers, then you might see a different version. If you haven’t upgraded, then the macOS Monterey version ships with Ruby 2.6.8. To check which version of the Ruby interpreter you have natively installed, run the command: How do I check which version of Ruby is installed on my Mac? To make that magic happen we turn to Ruby virtual environments. It also gives you the freedom to choose which version you want to work with. You’ll likely want to use Ruby 3 for a local development environment - which is a very good reason to move away from pre-installed Ruby versions. The latest version, Ruby 3.1.2, was released in April 2022, and is a major version upgrade from the one that is preinstalled on the macOS. If you run commands that change your native Ruby version, such as brew install ruby or brew uninstall ruby, then you risk breaking features and capabilities in your macOS (this also applies to Mac M1).Īlso, it’s important to point out that the preinstalled version of Ruby on the macOS is outdated, which, on a new 2022 M1 laptop, resolves to ruby 2.6.8p205. They also point out that Apple has plans for deprecating their pre-installed versions of Python, Ruby, and Perl. ![]() Brew by default installs to /usr/local and according to postmodern, this doesn’t interfere with the Apple system Ruby scripts because their interpreter location is hardcoded to /usr/bin/ruby. That said, Reddit user postmodern shared on a Ruby thread that you could probably instruct the brew installation to be explicitly installed onto a different directory. I highly recommend you avoid that completely. Some guides and blog articles will instruct you to install Ruby by running brew install ruby or updating your existing Ruby versions on a macOS by running the update ruby mac command.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |