It's been a long time before I could do rbenv install 2.7.1
to use Ruby on Windows 10, so I summarized it.
The things to do are as follows.
source ~ / .bash_profile
brew install rbenv ruby-build
rbenv install 2.7.1
rbenv global 2.7.1
sudo apt install ruby
If all of these commands pass without error, the rest of the story is irrelevant. Since this is the first setting, the environment is not ready, and I will describe the error that occurred and how to deal with it. If you have the same error, please refer to it. I'm entering commands in order from the top.
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
Error: No such file or directory
Cause:.bash_I tried to add it where the profile file doesn't exist
Correspondence:.bash_Create profile file
Corrective action: touch ~ / .bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
source ~/.bash_profile
Error: Command'rbenv' not found, but can be installed with: sudo apt install rbenv
Cause:$(rbenv init -)I'm trying to use the rbenv command, but I don't understand rbenv
Action: Install rbenv
Corrective action: brew install rbenv ruby-build
Error: Command'brew' not found
Cause: I don't know brew
Action: Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew -v
(check if the brew command can be used)
Error: Command'brew' not found
Cause: I don't know where the installed Homebrew is.
Action: Give it through the path to Homebrew
Corrective action: ʻecho'export PATH = "/ home / linuxbrew / .linuxbrew / bin: $ PATH"' >> ~ / .bashrc Corrective action:
source ~ / .bashrc`
brew -v
Error: Command'brew' not found
Cause:.bash_You also need to pass the path to the profile file
Correspondence:.bash_Add settings to profile file
Corrective action: ʻecho export PATH ='/ usr / local / bin: $ PATH' >> ~ / .bash_profile Corrective action:
source ~ / .bash_profile`
brew -v
(displayed as Homebrew 2.5.2)brew install rbenv ruby-build
source ~ / .bash_profile
(Since rbenv is installed, save the rewrite of .bash_profile)rbenv install --list-all
(list of installable rbenv versions)rbenv install 2.7.1
(Install Ver. 2.7.1 this time)Error: configure: error: C compiler cannot create executables
Cause: Homebrew didn't have what it needed
Action: Install what is missing
Workaround: sudo apt install build-essential curl file git
Error: E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Cause: apt-get is not up to date
Correspondence: apt-update get
Corrective action: sudo apt-get update
sudo apt install build-essential curl file git
rbenv install 2.7.1
Error: ERROR: Ruby install aborted due to missing extensions. Try running apt-get install -y zlib1g-dev to fetch missing dependencies.
Cause: zlib1g-There seems to be no dev
Correspondence: zlib1g-install dev
Workaround: sudo apt-get install -y zlib1g-dev
rbenv install 2.7.1
rbenv versions
(confirm that the specified version of rbenv is installed)rbenv global 2.7.1
(Reflect the version of rbenv as a whole. If only a specific directory is set, set it as local instead of global.)ruby -v
Error: Command'ruby' not found, but can be installed with: sudo apt install ruby
Cause: ruby itself is not yet
Action: Install ruby
Corrective action: sudo apt install ruby
ruby -v
(displayed as ruby 2.7.1p83)I would be very grateful if you could let me know if there is something wrong with the cause or response. I hope it will be helpful for you!
Thank you very much for your help.
Notes for researching and summarizing
Recommended Posts