Mika
Mika

Reputation: 1152

I cannot add PATH to PATH file on mac

Here are my .bash_profile and .profile files:

BASH PROFILE

# Set architecture flags
export ARCHFLAGS="-arch x86_64"

# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave
export PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"

export PATH="$HOME/Applications/Postgres.app/Contents/Versions/9.3/bin:$PATH"

#Virtualenvwrapper
export WORKON_HOME=$HOME/Devaus/Envs
export PROJECT_HOME=$HOME/Devaus/Envs
source /usr/local/bin/virtualenvwrapper.sh

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session         *as a function*

PROFILE

export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.3/bin
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*

echo $PATH

/Users/User/Devaus/Envs/wsd/bin:/Users/User/.rvm/gems/ruby-2.1.1/bin:/Users/User/.rvm/gems/ruby-        2.1.1@global/bin:/Users/User/.rvm/rubies/ruby-    2.1.1/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/User/.rvm/bin

The question is why /Applications/Postgres.app/Contents/Versions/9.3/bin won't be added to PATH? My goal is to use psqletc commands stated in here http://postgresapp.com/documentation/cli-tools.html

Upvotes: 0

Views: 220

Answers (1)

tripleee
tripleee

Reputation: 189367

Bash does not automatically read .profile if you have a .bash_profile. Usually this is set up with .bash_profile explicitly loading .profile but you don't seem to have that. Maybe add this to the beginning of your .bash_profile:

test -e ~/.profile && . ~/.profile

Or alternatively put those things in your .bash_profile instead; but then if you need some or all of these settings with /bin/sh you can't do that. It is usually a better arrangement to only have specifically Bash-only code in your .bash_profile and keep your .profile portable to classic Bourne shell (which does not allow export before a variable assignment; so you have syntax error where

export variable=value

should be

variable=value
export variable

instead for portability.)

Incidentally, you only have to export once (andPATH should already be exported by the time Bash runs your personal login files, anyway).

Upvotes: 1

Related Questions