This is the first post in a long time.
I attended a tech camp in September 2019 and started working for a Rails in-house development company in July 2020! It took a while, but on the first day of my long-awaited engineer debut, I had a hard time building the environment for the supplied MacBook, so I will record it.
Rails 5.2.1 Ruby 2.5.1 MacOS Catalina10.15.6
Since I don't use Docker, I packed it from Ruby from an editor into a completely initial PC. This is the end of the day.
--Introduction of command line tools --Ruby version setting --MacOS compatibility (personally use mojave) --Understanding rbenv
At the basic stage of learning, the environment was built with the tech camp curriculum, so it took quite a while to build the environment on my own from scratch. It was a good review.
command line tools The command line tool is a "program that operates only with the keyboard". In short, it's a command to type from the terminal.
Install the Xcode "command line tools".
$ xcode-select --install
There is an article that you do not need to install Xcode itself, but in my environment Xcode itself also needed to be installed.
If you can confirm the version with this command, the installation is successful
$ xcodebuild -version
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
This is the error I encountered before installing Xcode itself
After installing Xcode itself, I solved it with the command ↓.
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
It looks like a command to switch to Xcode command line tools.
I wasn't really aware of it when I was learning, but Ruby version control is done with rbenv. A tool for managing multiple Ruby versions.
Install with homebrew.
#rbenv installation $ brew install rbenv ruby-build
Next, I will make it usable with bash, but in MacOS Catalina, the default login shell is zsh. It was bash in mojave.
Since there are still more materials in bash, I switched the login shell to bash here.
The login shell is the shell that is set immediately after login.
#Check available shells $ cat /etc/shells #switching $ chsh #Since vim opens, modify the file.
In Catalina, the terminal is marked with%. In mojave, it is $ notation.
I was impatient.
I've only used bash so far, and since bash has more Japanese materials, I switched zsh to bash, but I saw an article that zsh is upward compatible with bash. I feel that a warning has been issued at the terminal as well.
I think it's better to get used to zsh as soon as possible.
Then pass the path so that you can use the command in bash.
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc $ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile $ source ~/.bash_profile
Now you can use rbenv.
After that, I will finally install Ruby, Rails, and DB, but I will omit it because there was no particular point to get stuck. I referred to this article.
that's all. Thank you for your relationship!