Where is .bash_profile?

6,280

Where exactly am I supposed to add the following in .bash_profile?

export PATH=~/bin:$PATH
  1. Open ~/.bash_profile in your favourite editor.

  2. Add export PATH=~/bin:$PATH at the end of the file.

  3. Save the file.

  4. Start a new shell or terminal and PATH will have been updated to include the ~/bin directory.


Further Reading

Share:
6,280

Related videos on Youtube

4thSpace
Author by

4thSpace

Updated on September 18, 2022

Comments

  • 4thSpace
    4thSpace almost 2 years

    I'm trying to follow the instructions here: http://www.ladysign-apps.com/developer/mac-osx-run-sublime-from-your-terminal/#.Vj0ZfYRqmj4.

    Where is .bash_profile located?

    I see a .bash_profile.swp in the root of my user folder. Is that the same?

    When I open it, it looks like this:

    b0VIM 7.3������„(TÈï    �ÇÎmyuser�����������������������������MacBook-Pro.local�����������������������~myuser/.bash_profile���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������utf-8
    U3210����#"! U�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tp��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ad��⁄��������������˚��˙��√��à��á��S������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������source '/Users/myuser/google-cloud-sdk/completion.bash.inc'�# The next line enables bash completion for gcloud.��source '/Users/myuser/google-cloud-sdk/path.bash.inc'�# The next line updates PATH for the Google Cloud SDK.��quit�
    

    Where exactly am I supposed to add the following in .bash_profile?

    export PATH=~/bin:$PATH

    -- UPDATE --

    When I do nano ~/.bash_profile I see

    # The next line updates PATH for the Google Cloud SDK.
    source '/Users/myuser/google-cloud-sdk/path.bash.inc'
    
    # The next line enables bash completion for gcloud.
    source '/Users/myuser/google-cloud-sdk/completion.bash.inc'
    

    Where in there should I add

    export PATH=~/bin:$PATH
    
    • DavidPostill
      DavidPostill over 8 years
    • 4thSpace
      4thSpace over 8 years
      @DavidPostill: I don't think so.
    • DavidPostill
      DavidPostill over 8 years
      Really? You clearly didn't read it properly. "user-specific values may be given to those variables in scripts located in the home folder (e.g., /etc/profile, $HOME/.bash_profile)" in the section labelled OSX. if $HOME/.bash_profile doesn't exist then create it.
    • 4thSpace
      4thSpace over 8 years
      Real my question? Is that .bash_profile.swp? How do you edit it? I'd vote you down but I can't.
    • DavidPostill
      DavidPostill over 8 years
      No it's not. bash_profile.swp is some other file. You edit ~/.bash_profile with your favourite editor.
    • DavidPostill
      DavidPostill over 8 years
      Why do you want to vote someone down who is trying to help you?
    • 4thSpace
      4thSpace over 8 years
      It's the SO way. Plus, your responses aren't helping.
    • DavidPostill
      DavidPostill over 8 years
      Really? I've told you exactly what to do and where to find the information you need to know. You can add export PATH=~/bin:$PATH at the end of the file.