It’s been a while since I posted.
I went to a tech camp in September 2019 and started working at a Rails in-house company in July 2020! It took some time, but on the first day of my debut as an engineer, I had a hard time constructing the environment for the MacBook provided, so I will record it.
Rails 5.2.1 Ruby 2.5.1 MacOS Catalina 10.15.6
Since I don’t use Docker, I packed it from the editor into Ruby on the completely initial PC. This is the end of the day.
- Introduction of command line tools
- Ruby version setting
- MacOS compatibility (for personal use mojave)
- Understanding rbenv
At the basic stage of learning, the environment was constructed using the tech camp curriculum, so it took quite a while to build the environment from scratch. It has become a review.
command line tools
The command line tool is a “program operated only by the keyboard”. The point is that you type in the command from the terminal.
Install the Xcode “command line tools”.
$ xcode-select --install
There is an article that you do not need to include Xcode itself, but in my environment Xcode itself also needed to be installed.
If the version can be confirmed 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
Here is the error I encountered before installing Xcode body
After installing Xcode itself, I solved it with the command below.
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
It looks like a command to switch to the command line tools of Xcode.
Ruby version setting
Although I didn’t pay much attention to the learning, rbenv manages the Ruby version. A tool to manage multiple Ruby versions.
Install with homebrew. *Homebrew is not installed in the initial state, so installation is required. homebrew is a Mac OS package manager.
# rbenv install $ brew install rbenv ruby-build
Next, I will make it usable with bash, but in Mac OS Catalina the default login shell is zsh. It was bash in mojave.
Since there are more bash materials as well, I switched the login shell to bash here.
The login shell is the shell set immediately after login.
# Check available shells $ cat /etc/shells # Switch $ chsh # vim will open, so modify the file.
In Catalina, the terminal is written in %. In mojave, it is $ notation.
I was rushed to the plain.
I have only used bash until now, and I switched zsh to bash because bash has more Japanese documents, but I saw an article that zsh is upward compatible with bash. I feel that there was a warning at the terminal as well.
I think it’s better to get used to zsh sooner.
Then pass the path so that you can use the command with 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 since there were no particular points to clog, I will omit it. I have referred to this article (https://qiita.com/kodai_0122/items/56168eaec28eb7b1b93b).
that’s all. Thank you for your association!