Search code examples
macosterminalgedit

Terminal stops working on MacOs after opening gedit


I have MacOs 10.14 and I installed gedit on my Mac via HomeBrew . When I open gedit typing :

gedit nameoffile

Terminal stops responding to commands. The only thing I can do in order to use Terminal again is to close gedit and terminate the session of Terminal and reopen it. Is there anything I can do to solve this ?

*** I managed to find a solution for not closing gedit when I terminate the session of Terminal : I have to open gedit with

sudo gedit nameoffile 

However also in this way Terminal stops responding to any command ...


Solution

  • When you run a command from terminal, the command takes over. It's possible that after you close the gedit window, the process continues to run for some reason.

    You can send a command to the background when starting it by adding & to the end:

    gedit nameoffile &
    

    This should instantly bring you back to the prompt when the process starts.

    Alternatively, you could pause the process by hitting Ctrl-Z, then do a variety of things with that process like: kill it using kill, unpause the process and send it to the background using bg, bring it back to the foreground using fg, see list of running jobs with jobs and more.

    You can read more about how terminal processes work here