Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Lshadow

macrumors newbie
Original poster
Sep 11, 2016
15
3
i typed in a command to help run something and now when ever i open terminal it says hhahahaahahahahahah shadow and wont let me run any commands
 

NoBoMac

Moderator
Staff member
Jul 1, 2014
5,773
4,360
Not much to go on, so, let's start with: what command did you run?
 

Lshadow

macrumors newbie
Original poster
Sep 11, 2016
15
3
yes i was trying to install pygame and that was one of the commands i saw to install it
 

Attachments

  • Screen Shot 2016-09-15 at 7.35.05 PM.png
    Screen Shot 2016-09-15 at 7.35.05 PM.png
    19.2 KB · Views: 163

Weaselboy

Moderator
Staff member
Jan 23, 2005
34,137
15,601
California
yes i was trying to install pygame and that was one of the commands i saw to install it
Ahh... I see. Looks like your Mac's hostname got changed. Run this to change it to what you want. Just substitute whatever you want for "name-you-want" there. Then restart Terminal.

Code:
sudo scutil --set HostName name-you-want
 

Lshadow

macrumors newbie
Original poster
Sep 11, 2016
15
3
i tried that but it says sudo command not found did something mess up in my sudoers file?
 

chown33

Moderator
Staff member
Aug 9, 2009
10,751
8,423
A sea of green
Try this, and post the complete output:
Code:
echo "$PATH" " PS1: $PS1"

It's best to copy and paste that line into a Terminal window, rather than typing it in manually.
 
Last edited:

chown33

Moderator
Staff member
Aug 9, 2009
10,751
8,423
A sea of green
Can you educate me a bit and explain what that command would do? Thanks :)
First, PATH is a shell variable. It contains a list of directories to look in for commands.

Second, 'echo' is a bash builtin command, i.e. it doesn't have to exist in any directory. So the 'echo $PATH' means "show the list of directories where bash is looking for commands".

All the earlier posted error messages indicate that bash is unable to find the command that was entered. Example message:
-bash: scutil: command not found​

Note the message is from bash (the '-bash:' part), and bash is telling you the command isn't found. It's not that 'scutil' is running and failing, it's that bash can't find an 'scutil' to run. The simplest explanation for this is that PATH is empty or contains a list of unusable directories.

The $PATH is quoted because if it contains oddball stuff, I don't want it to be interpreted.


The next part shows PS1, which is bash's prompt string 1. I put in a literal 'PS1:' in the 2nd quoted string, to separate it from the $PATH.

PS1 is a special string, which by default contains meta characters that will display the hostname, username, etc. However, PS1 can also contain literal characters, which are simply emitted as the prompt. For example, try this sequence of commands in a Terminal window:
Code:
save_PS1="$PS1"
PS1="mwa-ha-ha \\u \$"

The first line saves the current value of PS1. The 2nd line sets PS1 to a different prompt. You'll see what happens (nothing horrible, I promise).

You can restore the original PS1 with this command:
Code:
PS1="$save_PS1"

What I suspect has happened is that whatever has set PATH to some useless value has also set PS1 to a string containing the literal text "hhahahaahahahahahah". The "shadow" part of the prompt might be a literal, or it could be the username, considering the MR id this user signed up as.

So by asking to see the value of PS1, I'm trying to see if the "hhahahaahahahahahah" is in PS1, or whether the hostname might have actually been changed.


I suspect the underlying cause of all this mayhem is that one of the bash profile files in the user's home dir is damaged or corrupted, possibly intentionally by whatever command was actually run.

Looking at bash profiles is where I'll go next, once I find out what PATH is (and correct it), and what PS1 is (and correct it).
 
Last edited:

Lshadow

macrumors newbie
Original poster
Sep 11, 2016
15
3
this is the output of that command: shadow is the account name

’/usr/local/bin:?? PS1: \h:\W \u\$
 

chown33

Moderator
Staff member
Aug 9, 2009
10,751
8,423
A sea of green
this is the output of that command: shadow is the account name

’/usr/local/bin:?? PS1: \h:\W \u\$
The PATH variable is completely garbled and useless. The PS1 variable seems ok.


I'm going to post only one step at a time.

If there's an error message of any kind, stop, then copy and paste the complete text from the Terminal window into a post. You can click and drag to select text in the Terminal window.

Accuracy is important. Read through the instructions. If you have a question about what to do, ask it here before doing anything.

Step 1
Copy and paste this exact command into a Terminal window:
Code:
PATH="/usr/bin:/bin:/usr/sbin:/sbin"

In the same window, copy and paste this exact command:
Code:
ls -ld ~/.bash* ~/.*profile*

Then copy and paste the complete output into a post here.

If things are working correctly, the 2nd command above may print a message about something not found. Copy and paste the complete output and post it here.


I'll give Step 2 after I see the results of Step 1.
 

Lshadow

macrumors newbie
Original poster
Sep 11, 2016
15
3
hahahahahahaa:~ Shadow$ PATH="/usr/bin:/bin:/usr/sbin:/sbin"

hahahahahahaa:~ Shadow$ ls -ld ~/.bash* ~/.*profile*

-rw------- 1 Shadow staff 11894 10 Sep 15:40 /Users/anthony/.bash_history

-rw-r--r-- 1 Shadow staff 200 10 Sep 16:36 /Users/anthony/.bash_profile

-rw-r--r-- 1 Shadow staff 200 10 Sep 16:36 /Users/anthony/.bash_profile

drwxr-xr-x 100 Shadow staff 3400 20 Sep 07:54 /Users/anthony/.bash_sessions

hahahahahahaa:~ Shadow$

it says this{anthony = real name}
 

KALLT

macrumors 603
Sep 23, 2008
5,361
3,378
Try this and close the window afterwards.
Code:
/bin/mv ~/.bash_profile ~/.bash_profile~


Then try again:
Code:
echo "$PATH"
 

Lshadow

macrumors newbie
Original poster
Sep 11, 2016
15
3
ok this is the outcome
hahahahahahaa:~ Shadow$ /bin/mv ~/.bash_profile ~/.bash_profile~

hahahahahahaa:~ Shadow$

hahahahahahaa:~ Shadow$ Then try again:

-bash: Then: command not found

hahahahahahaa:~ Shadow$ Code:

-bash: Code:: command not found

hahahahahahaa:~ Shadow$ echo "$PATH"

’/usr/local/bin:??

hahahahahahaa:~ Shadow$
 

chown33

Moderator
Staff member
Aug 9, 2009
10,751
8,423
A sea of green
ok this is the outcome
hahahahahahaa:~ Shadow$ /bin/mv ~/.bash_profile ~/.bash_profile~

hahahahahahaa:~ Shadow$

hahahahahahaa:~ Shadow$ Then try again:

-bash: Then: command not found

hahahahahahaa:~ Shadow$ Code:

-bash: Code:: command not found

hahahahahahaa:~ Shadow$ echo "$PATH"

’/usr/local/bin:??

hahahahahahaa:~ Shadow$
The "Then try again" isn't commands for Terminal.
It also looks like you didn't close the Terminal window.

Please do the following:

1. Close all Terminal windows.
2. Open a new Terminal window.
3. Paste the following into the new Terminal window:
Code:
echo "$PATH"
4. Copy and paste the complete output into a post here.
 

Lshadow

macrumors newbie
Original poster
Sep 11, 2016
15
3
this is the output
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
 
  • Like
Reactions: Teon
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.