Where is Ruby getting added to my $PATH? - ruby

I’m using Mac Yosemite with bash shell. I had installed Ruby 2.2.1 but then wanted to upgrade it, so I installed Ruby 2.3.0. However, when I restart my terminal, my old Ruby installations in my PATH …
Daves-MacBook-Pro-2: davea$ echo $PATH
/Users/davea/.rvm/gems/ruby-2.2.1/bin:/Users/davea/.rvm/gems/ruby-2.2.1#global/bin:/Users/davea/.rvm/rubies/ruby-2.2.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/mysql/bin/:/opt/gradle-2.7/bin:/opt/apache-maven-3.3.3/bin:/Users/davea/.rvm/bin:/usr/local/mysql/bin
I can’t figure out how this part of my PATH is getting set. I have checked these files on my system
/etc/profile
/etc/bashrc
~/.profile
~/.bash_profile
But I don’t see references to Ruby 2.2.1 anywhere. Below are the files’ content. Are there any other files I should check to find references to the $PATH?
/etc/profile
# System-wide .profile for sh(1)
if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi
if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi
JBOSS_HOME=/opt/wildfly-10.0.0.CR2
M2_HOME=/opt/apache-maven-3.3.3
CATALINA_HOME=/opt/apache-tomcat-6.0.44
GRADLE_HOME=/opt/gradle-2.7
PATH=$PATH:/usr/local/mysql/bin/:$GRADLE_HOME/bin:$M2_HOME/bin
/etc/bashrc
# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
return
fi
PS1='\h:\W \u\$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize
# Tell the terminal about the working directory at each prompt.
if [ "$TERM_PROGRAM" == "Apple_Terminal" ] && [ -z "$INSIDE_EMACS" ]; then
update_terminal_cwd() {
# Identify the directory using a "file:" scheme URL,
# including the host name to disambiguate local vs.
# remote connections. Percent-escape spaces.
local SEARCH=' '
local REPLACE='%20'
local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
printf '\e]7;%s\a' "$PWD_URL"
}
PROMPT_COMMAND="update_terminal_cwd; $PROMPT_COMMAND"
fi
~/.profile
export JBOSS_HOME=$JBOSS_HOME
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
MYSQL=/usr/local/mysql/bin
export PATH=$PATH:$MYSQL
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
~/.bash_profile
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

RVM is setting up Ruby and related PATHS for you.
To get 2.3 run this
rvm --default use 2.3.0

Related

duplicate paths found in tmux mac

i have a mac terminal where i have a tmux session running. When i call my env variable, i get duplicate paths that repeat. I tried various solutions here but none seem to work. I'm using zsh shell by default.
What i tried:
Went to my zprofile and included the following line:
if [ -f /etc/profile ]; then
PATH=""
source /etc/profile
fi
Didn't work.
Went to my profile and have the following code, still didn't work:
if [ -x /usr/libexec/path_helper ]; then
PATH=""
eval `/usr/libexec/path_helper -s`
fi
if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi
My bashrc file:
if [ -z "$PS1" ]; then
return
fi
PS1='\h:\W \u\$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize
[ -r "/etc/bashrc_$TERM_PROGRAM" ] && . "/etc/bashrc_$TERM_PROGRAM"
All the above files are located in /etc/ directory.
All my env variables are in .zprofile.
Thanks
Actually, this worked for me.
tmux set-option -g default-command zsh
i put above statement in my terminal

Mac Terminal -bash: rbenv: command not found

Every time I open terminal on my Mac, the following outputs:
-bash: rbenv: command not found
Any idea how to stop this from appearing as it's annoying?
cat .*profile result:
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export PATH="$HOME/.rbenv/bin:$PATH"
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

OSX Terminal not recognizing ~/.bashrc and ~/.bash_profile on startup

The only way my .bashrc and .bashprofile are recognized by OSX is if I specify in my terminal's preferences for the file to be targeted upon boot. Is there a reason why they're not working like they should be?
Here's the inside of my .bashrc
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" #
Load RVM into a shell session *as a function*
#Add RVM to PATH for scripting. Make sure this is the last PATH
variable change.
export PATH="$PATH:$HOME/.rvm/bin"
smiley () { echo -e ":\\$(($??50:51))"; }
export PS1="\h\$(smiley) \e[30;1m\w\e[0m\n\$ "
Inside of .bash_profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" #
Load RVM into a shell session *as a function*
# Add RVM to PATH for scripting. Make sure this is the last PATH n .
variable change.
export PATH="$PATH:$HOME/.rvm/bin"
alias b='cd ..'
Any help would be appreciated! Thanks!
In OSX, all sessions are login sessions and will not source $HOME/.bashrc, they will source $HOME/.profile or $HOME/.bash_profile. So put the following in your .bash_profile
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi

Mac Yosemite 10.10 Terminal Command Not found

I'm having a strange problem,
My path looks like this
$ echo $PATH
/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/php5/bin/
$ vim ~/.bash_profile
[ [-s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export MONGO_PATH=/usr/local/mongodb
export PATH=$PATH:$MONGO_PATH/bin
export PATH=$PATH:/usr/local/bin/composer
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/php5/bin/
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
alias composer='/usr/local/bin/composer/composer.phar'
if [ -f ~/.ssh/id_rsa ]; then
ssh-add -K ~/.ssh/id_rsa 2>/dev/null
fi
I still get command not found for most of my mongod elastic-search and other commands, please help.
I Ended up reinstalling my Mongo and ElasticSearch Engine and it works fine, some thing must have gone wrong while upgrading to Yosemite.

SublimeREPL: mesg: ttyname: Inappropriate ioctl for device

When I try source ~/.profile in SublimeREPL for the bash shell I get the error above. Any ideas how to resolve this?
So this is the contents of my .profile. I start a bash instance inside bash I can source things normally.
##
# DELUXE-USR-LOCAL-BIN-INSERT
# (do not remove this comment)
##
echo $PATH | grep -q -s "/usr/local/bin"
if [ $? -eq 1 ] ; then
PATH=$PATH:/usr/local/bin
export PATH
fi
test -r /sw/bin/init.sh && . /sw/bin/init.sh
# Setting PATH for Python 2.7
# The orginal version is saved in .profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
##
# Your previous /Users/jonathan/.profile file was backed up as /Users/jonathan/.profile.macports-saved_2013-05-18_at_17:57:46
##
# MacPorts Installer addition on 2013-05-18_at_17:57:46: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
### Added correct profile for Postgres
export PATH="Applications/Postgres.app/Contents/MacOS/bin:$PATH"
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
# if running bash
if [ -n "$BASH_VERSION" ]; then
# startup virtualenv-burrito
if [ -f "$HOME/.venvburrito/startup.sh" ]; then
. "$HOME/.venvburrito/startup.sh"
fi
fi
### Added for Amazon CLI
export JAVA_HOME=$(/usr/libexec/java_home)
# ~/.profile: executed by Bourne-compatible login shells.
if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi
mesg n

Resources