SAP
SAP

Reputation: 67

How do I update the PATH in bash_profile on OSX

I'm trying to install flutter on my Mac, in order to do so I need to add a path to the .bash_profile. But when I run the command vim .bash_profile in the terminal ,I'm met with the following message.

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

export M2_HOME=/Applications/apache-maven-3.6.3
export PATH=$PATH:$M2_HOME/bin# added by Anaconda3 2019.10 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/Users/sofie-amaliepetersen/opt/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
    \eval "$__conda_setup"
else
    if [ -f "/Users/sofie-amaliepetersen/opt/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/Users/sofie-amaliepetersen/opt/anaconda3/etc/profile.d/conda.sh"
        CONDA_CHANGEPS1=false conda activate base
    else
        \export PATH="/Users/sofie-amaliepetersen/opt/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda init <<<

This is my first time adding a PATH, I've tried looking at setting path in terminal But I'm not sure how it applies to my problem.

Any suggestions would be appreciated. Thanks

Upvotes: 3

Views: 2541

Answers (2)

ArthurEKing
ArthurEKing

Reputation: 158

Something important to note, is that if you're using Catalina (Or any of the newer forms os osx) your computer won't be using the bash shell by default (Although you'll still be able to update your bash_profile, it won't work, as the computer doesn't care). You'll need to update your zshrc instead of the bash profile. (just typing zsh in your terminal should be able to switch between them, showing you a % instead of a $)

The same process as with the bash profile can be used, and the same line too. Also if you WANT the computer to use the bash profile instead you can force it, but there's no realistic functionality changes between the two in 99% of applications.

Upvotes: 2

Francesco Gasparetto
Francesco Gasparetto

Reputation: 1963

Anywhere in your .bash_profile, add this line

export PATH=$PATH:/your/new/path/to/add

This simply add /your/new/path/to/add to your existing $PATH

Upvotes: 0

Related Questions