0

The terminal on my Macbook Pro cannot find any commands until I enter this before every session I use :

export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

How can I make it so that I do not have to enter this every time I use the terminal to use commands?

2
  • Please add the content of /etc/paths (/bin/cat /etc/paths) and ~/.profile|.bash_profile|.bashrc (Example: /bin/cat ~/.bashrc). The latter three user profiles may not exist
    – klanomath
    Commented Dec 10, 2019 at 19:51
  • Also please post which shell you're using: echo $SHELL.
    – Harv
    Commented Dec 11, 2019 at 3:52

1 Answer 1

1

Each shell has ‘profile’ files, the contents of which are run when the shell is launched. For bash, this includes ~/.bash_profile. Create this file and add any commands you wish to run in that file, then relaunch your shell.

11
  • Command not found and permission denied. So I tried entering the export PATH and using sudo to do this but still it says command not found.
    – sawreals
    Commented Dec 10, 2019 at 19:35
  • @sawreals What are the exact commands you are using and what are the exact errors?
    – grg
    Commented Dec 10, 2019 at 19:37
  • The paths in the sawreals' PATH variable (which has to be set to get any command working except the shell) are standard paths already set globally (theoretically)! Something different has to be wrong!
    – klanomath
    Commented Dec 10, 2019 at 19:38
  • First I enter export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" to be able to enter anything into the terminal then sudo ~/.bash_profile gives command not found.
    – sawreals
    Commented Dec 10, 2019 at 19:40
  • @sawreals You need to create the file. That’s a file path, not a command, so you can’t execute it (the sudo is redundant). touch ~/.bash_profile to create it and/or use your editor of choice.
    – grg
    Commented Dec 10, 2019 at 19:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .