Cannot use terminal due to error in .bash_profile

I added some things to my .bash_profile on my Mac OS X and they gave an error. Here is my entire text log when I start the terminal now:

Last login: Thu Oct 25 23:10:03 on ttys000 dirname: illegal option -- b usage: dirname path -bash: /bin/naoqi-bin: No such file or directory -bash: exec: /bin/naoqi-bin: cannot execute: No such file or directory [Process completed] 

The problem is that since the "Process is completed", I cannot use the terminal. How can I access .bash_profile (I can’t find out how it works from finder), or how do I normally work with the terminal so that I can get it from the .bash_profile file?

+7
source share
4 answers

Open Terminal and go to File (or Shell) -> New Command . Type open -e .profile (or replace another file instead of .profile ) and click Run. This should open TextEdit with the file you want to fix; you can delete offensive lines there.

+16
source

For completeness, here's another way: open TextEdit (or your favorite GUI text editor). In the dialog that opens, press Command - Shift - Period , and it will display (and allow you to open) invisible files, such as .profile. Delete offensive lines, save, and you should be good to go.

+7
source

You can start Bash with disabled startup scripts to work around problems with startup scripts: choose Shell> New command and run bash --noprofile .

For more information on Bash command line options and startup files, see the Bash man page: x-man-page: // 1 / bash

Also note that you can search and view help pages in the terminal, even if your shell does not work by clicking the Help menu and entering a subject in the search field. The terminal displays the corresponding man pages. Select it from the Help menu to view it in a new window. You can also open the x-man-page: schema URL from any application.

+1
source

I could not open it with

 open ~/.bash_profile 

But when I introduced

 sudo open ~/.bash_profile 

It worked and I was able to open the file!

0
source

All Articles