MacOS – is the .bash_profile showing duplicated entries

bashmacospath

So I've been trying to do a cleanup of sorts on my mac OS .bash_profile (had a few issues with it), and now when I do echo $PATH on my Terminal I get the following:

/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
:/usr/local/sbin
:/usr/local/sbin
:/usr/local/sbin
:/usr/local/bin
:/usr/bin
:/bin
:/usr/sbin
:/sbin
:/Users/herrmartell/bin
:/usr/local/bin/mysql/bin
:/Users/herrmartell/bin
:/usr/local/bin/mysql/bin
:/Users/herrmartell/bin
:/usr/local/bin/mysql/bin

As you can see that's quite the number of duplicated entries. Which is odd, because this is what my .bash_profile looks like:

export PATH=$PATH:$HOME/bin
export PATH="/usr/local/sbin:$PATH"
export MYSQL_PATH="/usr/local/bin/mysql"
export PATH=$PATH:$MYSQL_PATH/bin
export JAVA_HOME="/path/is/too/long/sorry"
export PATH=${JAVA_HOME}:$PATH

I've tried looking for another .bash_profile/.bash*/.profile file which might be overriding mine, but found none, also the changes I make on this one file are reflected on my echo $PATH results.

Found something related, but it's on Ubuntu and to be honest I got lost: Why do I get duplicated entries in my $PATH?, and then something on Unix (lost me too, sorry): Duplicate entries in $PATH a problem?

So far, it's not giving me problems, but I'd like to avoid actually getting them in the future.

What is wrong on my file then? Thanks.

Best Answer

If you didn't already, try checking the following paths

cat ~/.bashrc
cat ~/.profile
cat ~/.bash_profile
cat /etc/bashrc
cat /etc/profile
cat /etc/bash_profile

You can also try

find ~ -type f -size -30k -exec grep -H herrmartell {} \;
find /etc -type f -size -30k -exec grep -H herrmartell {} \;
Related Question