I would like to switch Ruby versions on my Mac M1. My understanding is that Mac comes with a preinstalled version of Ruby (in my case, when I run ruby -v
I get:
ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin23]
I have installed ruby with brew:
ruby 3.3.1 is already installed and up-to-date.
How can I switch to this version? Nothing I have found online and tried has helped me so far.
I feel like something in one of my configuration files may be causing a conflict somewhere that doesn't allow me to switch versions.
Here is my .zshrc
:
if [ -d "/opt/homebrew/opt/ruby/bin" ]; then
export PATH=/opt/homebrew/opt/ruby/bin:$PATH
export PATH= gem environment gemdir /bin:$PATH
fi
#export PATH="/opt/homebrew/opt/ruby/bin:$PATH"
#[ -f "/Users/xxx/.ghcup/env" ] && source "/Users/xxx/.ghcup/env" # ghcup-env
export PATH=/usr/local/bin:$PATH
export PATH="$PATH:/Users/xxx/Library/Application Support/Coursier/bin"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/xxx/opt/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/xxx/opt/anaconda3/etc/profile.d/conda.sh" ]; then
. "/Users/xxx/opt/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/xxx/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
[ -f "/Users/xxx/.ghcup/env" ] && source "/Users/xxx/.ghcup/env" # ghcup-env
if [ "$ARCH" = '' ]
then
ARCH= arch
fi
export TOOLDIR=$HOME/c-tools
export PATH="$TOOLDIR/bin:$TOOLDIR/bin/$ARCH:$PATH"
if [ "$MANPATH" = '' ]
then
export MANPATH=$TOOLDIR/man
else
export MANPATH=${MANPATH}:$TOOLDIR/man
fi
export PATH="$PATH:/Users/xxx/flutter/flutter-2/bin"
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/xxx/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/xxx/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/xxx/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/xxx/google-cloud-sdk/completion.zsh.inc'; fi
export JAVA_HOME=$(/usr/bin/java)
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
Here is my .bash_profile
:
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/xxx/opt/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/xxx/opt/anaconda3/etc/profile.d/conda.sh" ]; then
. "/Users/xxx/opt/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/xxx/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
. "$HOME/.cargo/env"
# >>> coursier install directory >>>
export PATH="$PATH:/Users/xxx/Library/Application Support/Coursier/bin"
# <<< coursier install directory <<<
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
export PATH=${PATH}:/Users/xxx/prolog/bin/sicstus-4.7.0
Here is my .profile
:
export PATH=$PATH:/usr/local/go/bin
# >>> coursier install directory >>>
export PATH="$PATH:/Users/xxx/Library/Application Support/Coursier/bin"
# <<< coursier install directory <<<
I understand that most of the above is irrelevant but I have given these as I feel like there may be a conflict somewhere that is causing my issue.
openssl
andpsych
not being configured, but they are both already installed on my machine.rvm
by runningrvm install 3.3.1 --with-openssl-dir=/usr/local/opt/[email protected]
. Thank you so much!