bash: ~/.bash_profile: No such file or directory

前端 未结 4 1995
南旧
南旧 2021-02-20 11:27

I keep getting this error:

bash: ~/.bash_profile: No such file or directory

Here is my bash_profile:

alias ngrok=/Users/mmahalw         


        
相关标签:
4条回答
  • 2021-02-20 12:13

    Bash has ~/.profile instead of ~/.bash_profile

    Content of ~/.profile :

    # ~/.profile: executed by the command interpreter for login shells.
    # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
    # exists.
    # see /usr/share/doc/bash/examples/startup-files for examples.
    # the files are located in the bash-doc package.
    
    # the default umask is set in /etc/profile; for setting the umask
    # for ssh logins, install and configure the libpam-umask package.
    #umask 022
    
    # if running bash
    if [ -n "$BASH_VERSION" ]; then
        # include .bashrc if it exists
        if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
        fi
    fi
    
    # set PATH so it includes user's private bin if it exists
    if [ -d "$HOME/bin" ] ; then
        PATH="$HOME/bin:$PATH"
    fi
    
    0 讨论(0)
  • 2021-02-20 12:19

    In my case I was receiving the following error.

    -bash: /Users/mac241/.rvm/scripts/rvm: No such file or directory
    -bash: /Users/mac241/.rvm/scripts/rvm: No such file or directory
    

    After few checks, I got to know when I created .bash_profile file, below two commands already was prewritten on the file.

    source /Users/mac241/.rvm/scripts/rvm
    source /Users/mac241/.rvm/scripts/rvm  
    

    based on error, I got to know this are the problems and after I removed, It started working. Hope you are written and defined those commands only which you required to auto run up on shell start.

    0 讨论(0)
  • 2021-02-20 12:19

    Just go use ~./profile instead of ~./bash_profile

    This solved my problem, hope it solves yours too

    0 讨论(0)
  • 2021-02-20 12:23

    UPDATE

    The problem was a trailing "~/.bash_profile" 38L, 1070C which I had copied by mistake from vim. Thanks for the help!

    0 讨论(0)
提交回复
热议问题