Look at all the steps to build a Rails environment on a Mac - Qiita and aim to build Ruby 2.5.7, Rails 5.2.3.Once it was built, it is now being rebuilt for some reason.
rbenv (Ruby's version control tool)
Ruby
Rails
PostgreSQL (database)
Therefore, Additional References and Tries: I would appreciate it if you could let me know. The shell→ command /bin/sh must be specified from the terminal. Check the PATH to be added and try adding it in Note: How to set, change, add, confirm, and reorder the environment variable PATH on your Mac Find out what PATH to add and try adding it with Note: How to set, change, add, confirm, and reorder the environment variable PATH on your Macrbenv global 2.5.7
after rbenv global 2.5.7
while looking at rbenv global, the version does not change, and ruby-v
displays "2.6.3" as follows: ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]
Install multiple versions of Ruby using rbenv - Qiita
How to change (downgrade) Ruby and Rails versions
Therefore, specify /bin/sh to perform the task.$rbenv versions
system
2.5.0
2.5.1
2.5.3
* 2.5.7 (set by / Users / XXXXXXXX / .ruby-version)
2.6.3
2.6.6
$ which ruby
/usr/bin/ruby
$ rbenv which ruby
/Users/XXXXXX/.rbenv/versions/2.5.7/bin/ruby
$ echo$SHELL
/bin/bash
$ export-p
export HOME="/Users/XXXXXXX"
export LANG="ja_JP.UTF-8"
export LOGNAME="XXXXXXX"
export OLDPWD
export PATH="/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/sbin:/library/Apple/usr/bin"
export PWD="/Users/XXXXXXX"
export SHELL="/bin/bash"
export SHLVL="1"
exportSSH_AUTH_SOCK="/private/tmp/com.apple.launchd.8NzqzRIZgl/Listeners"
export TERM="xterm-256 color"
export TERM_PROGRAM="Apple_Terminal"
export TERM_PROGRAM_VERSION="440"
export TERM_SESSION_ID="C1F542F7-D155-495D-85C4-4D10A38F555E"
export TMPDIR="/var/folder/km/9g8j45755p30v4fnqq5950qr0000gn/T/"
export USER="XXXXXXX"
exportXPC_FLAGS="0x0"
exportXPC_SERVICE_NAME="0"
export__CFBundleIdentifier="com.apple.Terminal"
sudo vi~/.bashrc
.!sudovi~/.bashrc
Deleted everything!sudovi~/.bash_profile
forced the eval "$(rbenv init-)"
.$ls-la to /.bash*
-rw ------------- 1XXXXX staff 13338 218 10:13 / Users /XXXXXXX /.bash_history
-rw -r --r --1XXXXXX staff 174 2 18 10:47 / Users /XXXXXXX /.bash_profile
-rw -r --r --1XXXXXXX staff12288 29 17:58 / Users /XXXXXXX /.bash_profile.swo
-rw -r --r --1XXXXXXX staff12288 29 17:25 / Users /XXXXXXX /.bash_profile.swp
-rw -r --r --1XXXXXX staff 192 18 10:39 / Users /XXXXXXX /.bashrc
-rw-r--r--1 root staff 122882 18 10:12 / Users / XXXXXXX /.bashrc.swp
/Users/XXXXXXX/.bash_sessions:
total 760
omission
sudo vi~/.bashrc
.!sudovi~/.bashrc
Removed everythingeval "$(rbenv init-)"
was forcibly added in !sudovi~/.bash_profile
.$ls-la to /.bash*
-rw ------------- 1XXXXX staff 13338 218 10:13 / Users /XXXXXXX /.bash_history
-rw -r --r --1XXXXXX staff 174 2 18 10:47 / Users /XXXXXXX /.bash_profile
-rw -r --r --1XXXXXXX staff12288 29 17:58 / Users /XXXXXXX /.bash_profile.swo
-rw -r --r --1XXXXXXX staff12288 29 17:25 / Users /XXXXXXX /.bash_profile.swp
-rw -r --r --1XXXXXX staff 192 18 10:39 / Users /XXXXXXX /.bashrc
-rw-r--r--1 root staff 122882 18 10:12 / Users / XXXXXXX /.bashrc.swp
/Users/XXXXXXX/.bash_sessions:
total 760
omission
First of all, there is a file called .bashrc.swp
, and the user is root.
This is a working file that should only exist while editing .bashrc
in vi, and can be done in sudivi.bashrc
. There is nothing wrong with while sudovi~
, but it is strange that it exists when not.
If you have forcibly terminated vi and left it, erase it with sudorm.bashrc.swp
.
.bashrc
has four lines of exportPATH="$HOME/.rbenv:$PATH"
.
I don't need everything, so please delete it.
(By the way, I would like you to stop copying and pasting this information as it is extremely inconvenient if it is attached as a screenshot.)
#Add Visual Studio Code
The third line is incomplete.I think I did something wrong.You should have misconfigured the PATH on the second line, and the third line should have failed.
Let's turn it off. (Is it because of these two lines that I have to specify the shell→ command /bin/sh from the terminal?)
eval "$(rbenvinit-zsh)"
line, zsh setting must not be added to bash.
Also, if you have eval "$(rbenvinit-)"
, that's enough, so let's erase the line ↑.
If you want to do something about setting Visual Studio Code later, you only need the line eval "$(rbenvinit-)"
now.
Workaround when Ruby does not switch versions!
If you follow the steps below to reflect the changes to your PC, it will succeed! Sorry for the trouble.
$cd
$ vi through /.bash_profile
export PATH="~/.rbenv/shims:/usr/local/bin:$PATH"
event "$(rbenv init-)"
$ source to /.bash_profile
© 2024 OneMinuteCode. All rights reserved.