PDA

View Full Version : Terminal - Missing command prompt




AR3Y35
Feb 8, 2009, 10:47 AM
I'm not getting a command prompt in the Terminal app (Applications/Utilities). When I launch Terminal all I get is one line...

Last login: Sun Feb 8 08:22:27 on ttys003.

Right below that line is a solid cursor. When I press ENTER the only thing that happens is that the cursor skips to the next line. How do I get my command prompt back?

The last thing I did on Terminal was execute the following lines...
cd /private/etc
sudo cp php.ini.default php.ini

Please help. Thanks



angelwatt
Feb 8, 2009, 01:34 PM
There could be something goofed up in the .profile or .bash_profile file that get run when starting Terminal. Do other commands seem to work like "ls?" The PS1 variable is for the prompt. Try doing,
export PS1=": \w> "
That's what I set for the prompt anyways, it's not the default one, which I can't remember off hand. If that helps start looking in a few of those .files that I mentioned and see if they set the PS1 variable anywhere that may be deleting your prompt text.

plinden
Feb 8, 2009, 01:56 PM
So you're not actually getting past the startup text for Terminal, is that it?

Try creating a new user and opening Terminal in it.

If that works, type:
su - <your normal account name>

followed by your password. Do you get into Terminal for the original account that way?

If that works, it might be your Terminal preferences at fault. If not, try logging on as a separate admin account and renaming .bash_profile.

AR3Y35
Feb 8, 2009, 02:13 PM
Sorry for being such a noob. Thanks for replying.

I have a new MacBook Pro OS X 10.5.6. I've never created a .profile or .bash_profile file. Am I suppose to have those files by default? If so where may I find them?

I did find a bashrc file located in (private/etc). Here's what in the file...
# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then PS1='\h:\W \u\$ '; fi
# Make bash check its window size after a process completes
shopt -s checkwinsize

I'm looking up how to execute an "Is?" or "Is" command now (LOL).

However, I can execute commands like httpd -V, cd, hostname, and a bunch of other commands i found here http://www.ss64.com/osx/. I'm executing these commands by going to Shell->New Command.

AR3Y35
Feb 8, 2009, 02:23 PM
Thanks for replying.

So you're not actually getting past the startup text for Terminal, is that it?

Try creating a new user and opening Terminal in it.

If that works, type:
su - <your normal account name>

followed by your password. Do you get into Terminal for the original account that way?

If that works, it might be your Terminal preferences at fault. If not, try logging on as a separate admin account and renaming .bash_profile.

I tried creating a new user (with admin rights) and got the same problem logged on that new user.

I'm not sure what the startup text for Terminal is? What I can tell you is that the Terminal window does come up. I have a strange question. Would you expect the window title for Terminal to read "Terminal -- bash -- 80x24", "Terminal -- sh -- 80x24", or something else?

plinden
Feb 8, 2009, 02:43 PM
What I meant by "start up text" was what you said in your original post "Last login: Sun Feb 8 08:22:27 on ttys003"

Normally, you get that followed by the prompt, e.g:
Last login: Sun Feb 8 12:32:51 on ttys001
imac:~ plinden$

If bash is your default shell, you'll see the window title "Terminal -- bash -- 80x24".

Anyway, it looks like your shell isn't opening right. From your terminal, do a Shell -> new command -> "which bash". You should get "/bin/bash" returned. If you don't, try Shell -> new command -> "ls -la /bin/bash"

By the way "ls -la" has lowercase Ls - it's the list command with the options set to display details about the file listed.

AR3Y35
Feb 8, 2009, 02:54 PM
Thanks for replying.

What I'm getting is...
Last login: Sun Feb 8 12:32:51 on ttys001
but I don't get the...
imac:~ plinden$

The command "which bash" is returning /bin/bash.
The command "ls" is returning...
DEV Documents Library Music Public
Desktop Downloads Movies Pictures Sites

Here's why I ask about the Terminal title. Most of the time the title has sh. However, there's times when I first launch Terminal, the title reads bash. As soon as I hit ENTER, the title changes back to sh. Is that normal?

plinden
Feb 8, 2009, 03:02 PM
The name is specified by the Terminal Preferences. Open Preferences->Settings->Window. You can see how the title changes by selecting the different checkboxes.

Does Shell -> new command -> bash do anything?

AR3Y35
Feb 8, 2009, 03:12 PM
the bash command opens a new Terminal window (that's completely blank) without a prompt.

plinden
Feb 8, 2009, 03:15 PM
Open Terminal Preferences -> Startup. Does your window look like this?

Hmm, maybe it's the login command isn't completing. What does Shell -> new command -> which login return?

AR3Y35
Feb 8, 2009, 03:25 PM
Yes, my Startup window looks just like your attachment.

"which login" returns /usr/bin/login

angelwatt
Feb 8, 2009, 04:03 PM
Sounds like your commands are still working so that's good. Looks like you figured out the ls was short for list. When you open Terminal you'll be in your home directory. From here type,
pico .profile
This will open the file if it's already there or create it if not. Inside the file add the following line to the end of the file.
export PS1="\h:\W \u\$ "
Though if there's something already in the file that references PS1 then post that here. After entering the above do a ctrl+x to leave. It'll ask to save the file, just hit enter and you'll be back at the missing prompt. Close and restart Terminal and see if things are better.

AR3Y35
Feb 8, 2009, 04:56 PM
Thanks for all the help.

Creating the .profile didn't change anything. How do I find out where that file was saved to?

I did notice there already was a profile in private/etc. Here's what the file looks like...
# System-wide .profile for sh(1)

if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi

if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi

As posted earlier, a batchrc file in the same folder looks like this...
# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then PS1='\h:\W \u\$ '; fi
# Make bash check its window size after a process completes
shopt -s checkwinsize

AR3Y35
Feb 8, 2009, 05:44 PM
For what it's worth, I first notice this problem when I activated PHP on Apache.

On another forum, a user suggested this command...
dscl . -read /Users/<username> shell

His expected return was something like...
mikeMbp:etc mike$ dscl . -read /Users/mike shell
dsAttrTypeNative:shell: /bin/bash

My actual return was only one line...
dsAttrTypeNative:shell: /bin/bash

I didn't get anything like...
mikeMbp:etc mike$ dscl . -read /Users/mike shell

angelwatt
Feb 8, 2009, 05:55 PM
Creating the .profile didn't change anything. How do I find out where that file was saved to?

It saves to the directory you were in when you went into pico, which was your home directory. You won't see the file in Finder because it's a hidden file. Files that start with a . are hidden files. In Terminal is you use the command,
ls -a
it'll show hidden files along with other items in the folder.

When I tried that dscl command I got the same thing as you so I don't think that's anything to be worried about.

When you activated PHP, what files did you modify? I'm guessing the httpd.conf file, but any others? Is Apache running currently? See if there's any difference with it off.

AR3Y35
Feb 8, 2009, 06:08 PM
Correct, I modified httpd.conf. In addition, I also made a copy of php.ini.default named php.ini. Then I modified the copied file (php.ini). Here's the simple steps I took to activate PHP http://foundationphp.com/tutorials/php_leopard.php. The two files modified where in private/etc.

I've also turned Web Sharing off, restarted my machine, and launched Terminal again...no luck.

plinden
Feb 8, 2009, 08:32 PM
None of the steps on that php page should really have affected Terminal.

I don't use php (after having to maintain some php code a few years ago, I avoid it). I might try to do so anyway to see if I can reproduce this. I don't have time right now though.

If you're getting the same behaviour with all accounts, it's probably something in some of the system wide files.

There was another question earlier today where someone's sudo stopped working after installing php ...

angelwatt
Feb 8, 2009, 09:35 PM
There might be a typo in the php.ini file. I believe there's some parts that change the path variable. If there's a typo there it could have a cascading effect. Though the directions in the tutorial don't really say much about modifying anything there. What modifications did you make to the file? If I'm following the thread correctly, you first noticed the prompt issues after making a copy of the php.ini.default file. Did you get prompted for your password after that?

AR3Y35
Feb 9, 2009, 03:49 AM
I only changed 1 line in the php.ini file. I change error_reporting = E_ALL & ~E_NOTICE to error_reporting = E_ALL.

Yes, I'm pretty sure I was prompted for my password when copying the sample php.ini file.

Thanks for all the help.

bigvirgil
Jun 25, 2010, 06:47 AM
Hi,

I know it's not exactly a fresh thread but I've been experiencing the same issue for a very long while now (years actually) without getting to ever sort it out.

I happened to find a workaround by swapping the default "/bin/bash" by "/bin/zsh" in "Shell open with" in Terminal's preferences so I was kinda ok with that but it's far from ideal and I'm still looking for a proper fix every now and then.

This thread interrupted a bit sharply without giving any clear solution, so did you eventually find a fix?

Thanks.