RVM: Warning! PATH is not properly set up - bash

I am on a Ubuntu 14.04 LTS machine running rvm 1.27.0.
When I run rvm list I receive the following warning:
Warning! PATH is not properly set up, '/home/asarluhi/.rvm/gems/ruby-2.3.1/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-2.3.1'.
The output of echo $PATH is:
/home/asarluhi/bin:/home/asarluhi/.rvm/gems/ruby-2.3.1/bin:/home/asarluhi/.rvm/gems/ruby-2.3.1#global/bin:/home/asarluhi/.rvm/rubies/ruby-2.3.1/bin:/home/asarluhi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/asarluhi/.rvm/bin:/home/asarluhi/.rvm/bin:/home/asarluhi/.rvm/bin:/usr/local/heroku/bin:/home/asarluhi/.rvm/bin:/home/asarluhi/.rvm/bin:/home/asarluhi/.rvm/bin:/home/asarluhi/.rvm/bin
As you can see, in effect /home/asarluhi/bin comes first and also /home/asarluhi/.rvm/bin is repeated 7 times.
The last two lines of my ~/.bashrc file are:
### Added by the Heroku Toolbelt
export PATH="$PATH:/usr/local/heroku/bin"
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
The last lines of my ~/.profile file are:
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
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*
The content of my ~/.bash_profile is:
export GITAWAREPROMPT=~/.bash/git-aware-prompt
source "${GITAWAREPROMPT}/main.sh"
[[ -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*
To remove the exceeding /home/asarluhi/.rvm/bin i might probably try to remove the duplicate lines in ~/.profile. However I do not know how to solve the Warning! PATH is not properly set up issue. I tried to change the order of $PATH in ~/.profile for my private bin and for rvm as follows:
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$PATH:$HOME/bin"
fi
export PATH="$HOME/.rvm/bin:$PATH" # Add RVM to PATH for scripting
I also changed the order of $PATH in ~/bashrc as I did for ~/.profile.
However I keep receiving the same warning.
As you can see, now there is /home/asarluhi/.rvm/bin at first place:
~ $ echo $PATH
/home/asarluhi/.rvm/bin:/home/asarluhi/.rvm/bin:/home/asarluhi/.rvm/gems/ruby-2.3.1/bin:/home/asarluhi/.rvm/gems/ruby-2.3.1#global/bin:/home/asarluhi/.rvm/rubies/ruby-2.3.1/bin:/home/asarluhi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/asarluhi/.rvm/bin:/home/asarluhi/.rvm/bin:/home/asarluhi/.rvm/bin:/usr/local/heroku/bin:/home/asarluhi/bin

The only necessary edit to the config dotfiles is to prepend $PATH to $HOME/bin in ~/.profile as follows:
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$PATH:$HOME/bin"
fi

Related

$PATH error every time Terminal is Opened

I had installed Postgres.app before and after I uninstalled via App Cleaner now every time I open terminal this error appears in the first line I should mention that a followed what documentation for uninstalling the Postgres on their website but it doesn't work for me.
Warning: $PATH entry "/Applications/Postgres.app/Contents/Versions/9.6/bin" is not valid (No such file or directory)
.bash_profile:
# source ~/.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"
eval "$(rbenv init -)"
export PATH="/usr/local/opt/node#6/bin:$PATH"
how can I get rid of this annoying warning?
Thanks.
You should look at all bash initialization files. There may be many, depending on your distro. There's a good list on tldp:
/etc/bash.bashrc
/etc/profile
/etc/bashrc
~/.bash_profile
~/.bash_login
~/.profile
~/.bashrc
Consider that some of these files may also include all files in some directory. For example on most instances /etc/profile will run every .sh file in /etc/profile.d/, this may include a paths file called /etc/profile.d/extrapaths.sh.
EDIT:
After checking the documentation for PostgresApp (1, 2), and this issue I found that it uses a file called /etc/paths.d/postgresapp. Be sure to check it.
If you'd like to remove the paths, it states that you should run the following command:
sudo rm /etc/paths.d/postgresapp

Correct $PATHs on .bash_profile for npm packages (Sublime)

So I think I somehow messed up my $PATH settings and now only some of my Sublime Text packages are working. For example, I just added Minify (globally), and I can see it in the packages dropdown menu but the commands don't do anything.
From what I can make out so far, there are discrepancies between what is in
./npm-packages/
and
/usr/local/bin
My .bash_profile currently looks like this:
source ~/.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*
# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
PATH="/usr/local/bin:$PATH”
PATH="~/.npm-packages/bin:$PATH”
export PATH
I'm not so good when it comes to system operations so if anyone has an idea of what I've done wrong, it would be hugely appreciated.

Need to Fix PATH in my bashrc File for RVM

I did a clean install of my operating system recently and copied my old .bashrc file from a backup. I installed rvm version 1.26.10 (latest stable version). I installed ruby 2.2.0. When I source the .bashrc file I get the following error:
Warning! PATH is not properly set up, '/Users/myusername/.rvm/gems/ruby-2.2.0#mygemset/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-2.2.0#mygemset'.
Here are my PATH statements. The first line I included here is one that was in the new install of RVM in the .bash_profile file. I copied them into .bashrc. I'm also running postgres.app which requires the last statement in order to set it as the current PostgreSQL instance.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
PATH="$PATH:$HOME:/.rvm/rubies/ruby-2.2.0/bin/ruby:/usr/bin/psql:/usr/local:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
export PATH="$PATH:$HOME/.rvm/bin"
export PATH=/Applications/Postgres.app/Contents/Versions/9.4/bin:$PATH
I started with the .bashrc file recommended by the Ruby on Rails Tutorial by Michael Hartl (the version current in 2011 or 2012) and the settings used by RVM back then. I know things have changed a bit since then.
My bash knowledge is limited so any help would be appreciated.
UPDATE: 2/2/2015 2:40 pm CST
I changed my bash statements to the following and got rid of the warning:
export PATH="$PATH:$HOME/.rvm/bin"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
PATH="$PATH:$HOME:/.rvm/rubies/ruby-2.2.0/bin/ruby:/Applications/Postgres.app/Contents/Versions/9.4/bin:/usr/bin/psql:/usr/local:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
UPDATE: 2/2/2015 5:14 pm CST
Here are my Bash statements:
PATH="$PATH:$HOME:/.rvm/rubies/ruby-2.2.0/bin/ruby:/Applications/Postgres.app/Contents/Versions/9.4/bin:/usr/bin/psql"
export PATH="$PATH:$HOME/.rvm/bin"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Here is the output for echo $PATH:
/Users/username/.rvm/gems/ruby-2.2.0#gemsetname/bin:/Users/username/.rvm/gems/ruby-2.2.0#global/bin:/Users/username/.rvm/rubies/ruby-2.2.0/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/Server.app/Contents/ServerRoot/usr/bin:/Applications/Server.app/Contents/ServerRoot/usr/sbin:/Users/username/.rvm/bin:/Users/username:/.rvm/rubies/ruby-2.2.0/bin/ruby:/Applications/Postgres.app/Contents/Versions/9.4/bin:/usr/bin/psql:/Users/username/.rvm/bin
My RVM wouldn't stop complaining about PATH even though the last thing in my .bashrc was this line:
# RVM
source ~/.rvm/scripts/rvm
So I just redirected the complaining to /dev/null:
# RVM
source ~/.rvm/scripts/rvm > /dev/null 2>&1
rvm use default > /dev/null 2>&1
The last line also makes sure RVM is first in PATH, so it doesn't really have anything to complain about.
rvm expects its $PATH stuff to come first in $PATH. You should add items to the $PATH before sourcing rvm, not after.
After dealing with this for several days I decided to go ahead and continue to proceed with my implementation of postgres.app with the warning message I got with RVM. I ran my original bash statements in a different order.
export PATH="$PATH:$HOME/.rvm/bin"
PATH="$PATH:$HOME:/.rvm/rubies/ruby-2.2.0/bin/ruby:/usr/bin/psql:/usr/local:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
export PATH=/Applications/Postgres.app/Contents/Versions/9.4/bin:$PATH
I was successful in implementing postgres.app. I still get the warning message but my Ruby on Rails applications are able to find the correct gems and run successfully.
You should add the line like this
export PATH= '/Users/myusername/.rvm/gems/ruby-2.2.0#mygemset/bin:other"
Maybe that can help you

Git update on Mac - bashrc

I'm trying to upgrade my Git on my Mac.
I went through the uninstall and install process, however, I think I must have something wrong with my .bashrc.
When I do git --version, it says it is using the old, uninstalled version. When I do which git, it references: /usr/local/bin/git
However, my .bashrc has the following:
PATH="/usr/local/git/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:$PATH"
$PATH=/usr/local/rvm/bin:$PATH
$PATH=/Users/mm/.rvm/gems/ruby-2.1.1
$PATH=/Users/mm/.rvm/gems/ruby-2.0.0-p247/bin
$PATH=Users/mm/.rvm/gems/ruby-1.9.3-p448/bin
$PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
"$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
When I cd into the usr/local/git/bin and then check the version, the new version is there. Does anyone know what I need to do in my .bashrc to make it pick up the new version and then why the old version which is supposed to have been uninstalled, is still showing as the version?
My .bash_profile is:
$PATH=/usr/local/git/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:$PATH
$PATH=/usr/local/rvm/bin:$PATH
$PATH=/Users/mm/.rvm/gems/ruby-2.1.1
$PATH=/Users/mm/.rvm/gems/ruby-2.0.0-p247/bin
$PATH=/Users/mm/.rvm/gems/ruby-1.9.3-p448/bin
$PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
"$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export PATH=/usr/local/bin:/bin:/usr/sbin:/sbin:/usr/local/binexport PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
export PATH=/usr/local/bin:/Users/mm/.rvm/gems/ruby-2.0.0-p247/bin:/Users/mm/.rvm/gems/ruby-2.0.0-p247#global/bin:/Users/mm/.rvm/rubies/ruby-2.0.0-p247/bin:/Users/mm/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
export PATH=/usr/local/bin:/Users/mm/.rvm/gems/ruby-2.0.0-p247/bin:/Users/mm/.rvm/gems/ruby-2.0.0-p247#global/bin:/Users/mm/.rvm/rubies/ruby-2.0.0-p247/bin:/Users/mm/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
I'm afraid Spellcheck just tells me not to put the $ in front of PATH at the beginning of the lines in my .bashrc. I have removed the $ from the left of the opening PATH in each line and I still get the old version of git and a reference to the path: /usr/local/bin/git when I ask 'which_git' in my terminal.

Adding directory to PATH on Mac

I'm trying to add a directory to my path, and I'm having trouble. I have a Macbook Pro running Mac OS X Lion 10.7.5. To make the changes I used the command:
open ~/.bash_profile
It opened up the profile file and it looked like this:
export PATH=${PATH}:/Users/Banderson/android-sdks/tools
export PATH=${PATH}:/Users/Banderson/android-sdks/platform-tools
#
# Your previous /Users/Banderson/.bash_profile file was backed up as /Users/Banderson/.bash_profile.macports-saved_2012-05-16_at_09:53:57
##
# MacPorts Installer addition on 2012-05-16_at_09:53:57: 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.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
# Setting PATH for JRuby 1.7.0.RC1
# The orginal version is saved in .bash_profile.jrubysave
PATH="${PATH}:/Library/Frameworks/JRuby.framework/Versions/Current/bin"
export PATH
Then I added this:
export PATH=${PATH}:/Users/Banderson/Documents/awstats-7.1/wwwroot/cgi-bin/
To make the .bash_profile look like this:
export PATH=${PATH}:/Users/Banderson/android-sdks/tools
export PATH=${PATH}:/Users/Banderson/android-sdks/platform-tools
export PATH=${PATH}:/Users/Banderson/Documents/awstats-7.1/wwwroot/cgi-bin/
#
# Your previous /Users/Banderson/.bash_profile file was backed up as /Users/Banderson/.bash_profile.macports-saved_2012-05-16_at_09:53:57
##
# MacPorts Installer addition on 2012-05-16_at_09:53:57: 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.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
# Setting PATH for JRuby 1.7.0.RC1
# The orginal version is saved in .bash_profile.jrubysave
PATH="${PATH}:/Library/Frameworks/JRuby.framework/Versions/Current/bin"
export PATH
After I added that, I saved it, then in the terminal, I executed the source ~/.bash_profile command, quit the terminal window, started a new window, and tried to launch a file from the directory I added to the path, but it didn't work. Can someone please tell me what I'm doing wrong and how I can fix it?
EDIT:
Here is what echo $PATH returns:
/Users/Banderson/.rvm/gems/jruby-1.6.8/bin:/Users/Banderson/.rvm/gems/jruby-1.6.8#global/bin:/Users/Banderson/.rvm/rubies/jruby-1.6.8/bin:/Users/Banderson/.rvm/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/Banderson/android-sdks/tools:/Users/Banderson/android-sdks/platform-tools:/Users/Banderson/Documents/awstats-7.1/wwwroot/cgi-bin/:/Library/Frameworks/JRuby.framework/Versions/Current/bin
Your problem seems to be the inclusion of the rvm scripts. I guess, there your path is overwritten.

Resources