Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My .bash_profile changes didnt take place even after restarting mac terminal, what can i do?

Tags:

python

bash

macos

So basically I tried to make changes to my path in my .bash_profile and save the changes but whenever I restart my terminal, it changes back to the default path and not the one ive set in .bash_profile

Ive tried to use the source ~/.bash_profile command but which i thought helped but somehow, when i restart the terminal, it doesnt change to the settings ive placed in .bash_profile

PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH

alias python=python3
alias pip=pip3

The expected output is when i type python in mac os terminal it should appear as python 3.7 and not python 2

like image 679
Rafie Suib Avatar asked Nov 02 '19 17:11

Rafie Suib


Video Answer


3 Answers

Put your commands into ~/.zshrc file on macOS Catalina

nano ~/.zshrc 
like image 72
Mikhail Sharin Avatar answered Oct 03 '22 09:10

Mikhail Sharin


Starting with macOS Catalina, the default interactive shell is zsh:
https://support.apple.com/en-us/HT208050

Make sure that you are using bash as your login shell.
You can check what is your login shell with the command echo $SHELL. If the result is /bin/bash, then you are using bash as your login shell. Otherwise you can change it with the command chsh -s /bin/bash.

like image 29
André Panisson Avatar answered Oct 03 '22 09:10

André Panisson


I think what you are trying to do should be in .bashrc file, and not .bash_profile

also maybe your .bashrc file override those aliases

you can read more about the difference of them here

like image 34
Reznik Avatar answered Oct 03 '22 07:10

Reznik