Found a swap file by the name adding the path in Flutter installation

1,140

You can delete the .swp file. It is just a file where Vim caches its changes to before you save. You likely were editing the file previously and unceremoniously exited vim, so it couldn't delete the .swp file before it closed.

Your .bash_profile is a file that bash reads when you open your terminal. It's where your bash preferences are saved. You update your PATH in your .bash_profile and that path gets read in as you open your terminal.

Share:
1,140
Aneema
Author by

Aneema

Updated on December 17, 2022

Comments

  • Aneema
    Aneema over 1 year

    I am following an online tutorial on Flutter development but I already got stuck with Flutter's installation.

    When I try to add Flutter's path to my computer (macOS Mojave 10.14.6):

    vim .bash_profile
    

    I got this message:

    Found a swap file by the name ".bash_profile.swp"
          owned by: username   dated: Wed Jan 15 01:04:29 2020
         file name: ~username/.bash_profile
          modified: YES
         user name: username   host name: name's-Air-2.local.tld
        process ID: 44340
    While opening file ".bash_profile"
             dated: Wed Jan 15 00:27:39 2020
    
    (1) Another program may be editing the same file.  If this is the case,
    be careful not to end up with two different instances of the same
    file when making changes.  Quit, or continue with caution.
    (2) An edit session for this file crashed.
    If this is the case, use ":recover" or "vim -r .bash_profile"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file ".bash_profile.swp"
    to avoid this message.
    
    Swap file ".bash_profile.swp" already exists!
    [O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort: 
    

    Pressing R of R(ecover) I get:

    Found a swap file by the name ".bash_profile.swp"
          owned by: giuliopiccolo   dated: Wed Jan 15 01:04:29 2020
         file name: ~giuliopiccolo/.bash_profile
          modified: YES
         user name: giuliopiccolo   host name: Giulios-Air-2.local.tld
        process ID: 44340
    While opening file ".bash_profile"
             dated: Wed Jan 15 00:27:39 2020
    
    (1) Another program may be editing the same file.  If this is the case,
    be careful not to end up with two different instances of the same
    file when making changes.  Quit, or continue with caution.
    (2) An edit session for this file crashed.
    If this is the case, use ":recover" or "vim -r .bash_profile"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file ".bash_profile.swp"
    to avoid this message.
    
    Swap file ".bash_profile.swp" already exists!
    ".bash_profile" 46L, 1556C
    Swap files found:
    Using specified name:
    1.    .bash_profile.swm
          owned by: username   dated: Wed Jan 15 01:08:49 2020
         file name: ~username/.bash_profile
          modified: YES
         user name: username   host name: users-Air-2.local.tld
        process ID: 47151
    2.    .bash_profile.swn
          owned by: username   dated: Wed Jan 15 00:54:07 2020
         file name: ~username/.bash_profile
          modified: YES
         user name: username   host name: users-Air-2.local.tld
        process ID: 38584
    3.    .bash_profile.swo
          owned by: username   dated: Wed Jan 15 00:51:29 2020
         file name: ~username/.bash_profile
          modified: YES
         user name: username   host name: users-Air-2.local.tld
        process ID: 37177
    4.    .bash_profile.swp
          owned by: username   dated: Wed Jan 15 01:04:29 2020
         file name: ~username/.bash_profile
          modified: YES
         user name: username   host name: users-Air-2.local.tld
        process ID: 44340
    In directory ~/tmp:
      -- none --
    In directory /var/tmp:
      -- none --
    In directory /tmp:
      -- none --
    
    Enter number of swap file to use (0 to quit): 
    

    How should I deal with it?

    Actually I don't' have any idea on what this bash.profiles stand for.

    EDIT: Once D(eleted) the .swpfile and restarting Flutter's installation I got this message from Python(?):

    # Setting PATH for Python 3.7
    # The original version is saved in .bash_profile.pysave
    PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
    export PATH
    
    ##
    # Your previous /Users/username/.bash_profile file was backed up
    as /Users/username/.bash_profile.macports-saved_2019-02-
    04_at_23:35:45
    ##
    
    # MacPorts Installer addition on 2019-02-04_at_23:35:45: adding an                  
    appropriate PATH variable for use with MacPorts.
    export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
    # Finished adapting your PATH environment variable for use with
    MacPorts.
    
    # added by Anaconda3 2018.12 installer
    # >>> conda init >>>
    # !! Contents within this block are managed by 'conda init' !!
    __conda_setup="$(CONDA_REPORT_ERRORS=false '/anaconda3/bin/conda'
     shell.bash hook 2> /dev/null)"
    if [ $? -eq 0 ]; then
    \eval "$__conda_setup"
    else
        if [ -f "/anaconda3/etc/profile.d/conda.sh" ]; then
    # . "/anaconda3/etc/profile.d/conda.sh"  # commented out by conda
     initialize
        CONDA_CHANGEPS1=false conda activate base
    else
        \export PATH="/anaconda3/bin:$PATH"
    fi
    fi
    unset __conda_setup
    # <<< conda init <<<
    
    # >>> conda initialize >>>
    # !! Contents within this block are managed by 'conda init' !!
    __conda_setup="$('/anaconda3/bin/conda' 'shell.bash' 'hook' 2>
     /dev/null)"
        if [ $? -eq 0 ]; then
    eval "$__conda_setup"
    else      
        if [ -f "/anaconda3/etc/profile.d/conda.sh" ]; then
            . "/anaconda3/etc/profile.d/conda.sh"
        else 
            export PATH="/anaconda3/bin:$PATH"
        fi
    fi           
    unset __conda_setup
    # <<< conda initialize <<< 
    
    ~                                                                                                                                                                                                         
    ~                                                                                                                                                                                                         
    ~                                                                                                                                                                                                         
    ~                                                                                                                                                                                                         
    ~                                                                                                                                                                                                         
    ~                                                                                                                                                                                                         
    ~                                                                                                                                                                                                         
    ~                                                                                                                                                                                                         
    ".bash_profile" 46L, 1556C
    

    What should I do at this point?

  • Aneema
    Aneema over 4 years
    Thank you Spencer, I edited my answer since I haven't enough space here in Comment.
  • Spencer Stolworthy
    Spencer Stolworthy over 4 years
    That's not a message from python, that's the vim interface :) That is the content of .bash_profile opened in vim. Vim can be a bit tricky if you're just learning it. I would recommend opening your bash profile in a gui text editor.
  • Aneema
    Aneema over 4 years
    I spent all this time working on it. Now inside vim .bash_profile there is: export PATH="$PATH:/Users/username/Developer/futter/bin". Then I hit the esc bottom and typed wq! to save everything. Restarting the terminal I checked if everything was working but I got again: $ flutter --version $ command not found. Still stuck again :(
  • Spencer Stolworthy
    Spencer Stolworthy over 4 years
    Try sourcing your .bash_profile: source ~/.bash_profile
  • Spencer Stolworthy
    Spencer Stolworthy over 4 years
    It sounds like taking a quick intro tutorial to bash and/or unix may be useful as well. All the necessary terminal commands can be tricky to get a start on without some of that precursory stuff.
  • Aneema
    Aneema over 4 years
    FINALLY SOLVED! Instead of editing the path character by character, I moved the director with the drag and drop feature of macOS. The string remained the same, but it started working out while asking for flutter --version