How To Install Old Version Ruby 2.7.1 and 2.7.2 on M1 Mac
- Categories:
- ruby
Installing old version Ruby version 2.7.1 and 2.7.2 always raises an error on my Apple M1 Macbook. These are my steps on how to install Ruby 2.7.1 and 2.7.2 on my M1 Macbook with Homebrew and asdf
. But because under the hood asdf
use rbenv
, I assume it should work too with rbenv
.
My Macbook specifications:
- MacBook Pro (13-inch, M1, 2020)
- Chip Apple M1
- macOS Monterey version 12.1
- Memory 16GB
1. Install or Upgrade asdf and asdf-ruby
Install asdf
and add Ruby plugin to asdf
.
Or upgrade existing asdf
and asdf-ruby
plugin.
2. Install Ruby
Version 2.7.1
Add the following ENV variable to .zshrc
.
And install Ruby 2.7.1 with the following command.
If the installation is successful, run asdf list
, it will shows Ruby 2.7.1.
Version 2.7.2
If Ruby is already installed, reinstall the current versions of openssl
, readline
and ruby-build
in order to have the latest versions and configs.
add the following ENV variables to .zshrc
.
Install Ruby 2.7.2 with the following command.
If the installation is successful, run asdf list
, it will shows Ruby 2.7.2.
Based on Stack Overflow, above ENV variables should work too on Ruby 2.6.x, but I’ve never tried to install Ruby 2.6.x.
References
Sponsored Links
- Register to Digital Ocean cloud with this link and get $200 credit
- Looking for cheap CDN? Bunny is the answer
- Alternative Cloud besides AWS and Digital Ocean