7

I added some things to my .bash_profile on my Mac OS X and they give an error. Here is my entire log of text when I start a 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 "Process completed", I can't use terminal. How do I access .bash_profile (I can't find out how from the finder), or how do I run terminal normally again so I can get that out of the .bash_profile file?

2

4 Answers 4

17

Open Terminal, and go to File (or Shell) -> New Command. Type in open -e .profile (or substitute some other file instead of .profile), and hit Run. That should open TextEdit with the file you want to fix; you can remove the offending lines there.

Sign up to request clarification or add additional context in comments.

Comments

7

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

Comments

1

You can run Bash with all startup scripts disabled to get around problems with startup scripts: choose Shell > New Command and run bash --noprofile.

See the Bash man page for more information about the Bash command-line options and startup files: x-man-page://1/bash

Also note that you can lookup and view man pages in Terminal even when your shell isn't working, by clicking on the Help menu and entering a topic in the search field. Terminal will display matching man pages. Choose one from the Help menu to view it in a new window. You can also open an x-man-page: scheme URL from any application.

Comments

0

I could not open it with:

open ~/.bash_profile 

But when I entered

sudo open ~/.bash_profile 

It worked and I was able to open the file!

1 Comment

You absolutely should not need sudo to open your .bash_profile in the first place; it needs to be owned by yourself.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.