Terminal login failed

Discussion in 'OS X Yosemite (10.10)' started by 66Mike99, Jan 17, 2015.

  1. 66Mike99 macrumors newbie

    Jan 17, 2015
    Alberta Canada
    Hi. I am new to computing but do have some experience from years ago. I have a new mac with osx 10.10.1. In the process of installing/starting Apache, PHP and mySQL the login for Terminal quit working. It was near the end appending the path or changing permissions on some files. I have three screen shots. One is the terrminal screen run with default settings having timed out after 15 seconds. The Inspector screen was taken during the 15 seconds. The other screen was changing the command line to login with no path. Any help would be appreciated. Thanks Mike

    Attached Files:

  2. chown33, Jan 17, 2015
    Last edited: Jan 17, 2015

    chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    Try this.

    1. Launch Automator.app.
    2. Choose Workflow if it prompts for what kind of document to creat.
    3. At left, make sure Actions is pressed and Variables isn't.
    4. In the search box (rounded with magnifying glass) enter shell.
    5. A single action should appear in the right-hand list: Run Shell Script.
    6. If this doesn't happen, stop and post again.
    7. Double-click Run Shell Script to add it to the empty workflow.
    8. Delete everything in the template command (it probably says 'cat') (cmd-A, delete).
    9. Paste the following in as the commands:
      /bin/ls -la ~/
    10. Press the Results button and observe the bottom of the Action pane expands to show an empty list.
    11. Click the Run button in the window's toolbar (or press cmd-R).
    12. The command should produce some output.
      If it doesn't, stop and describe exactly what happened, preferably with a screenshot of Automator.
    13. Copy and paste the output in its entirety into a reply here.
      Use CODE tags.
      You can select and copy all the output items to the clipboard by selecting one item in the list, then cmd-A (Select All), cmd-C (Copy).

    Once we know what shell profile files you have in your home directory, we can tell you how to move them. As above, the commands will be pasted into an Automator "Run Shell Script" action.

    There are other approaches; this isn't the only one. For example, you could create a new User account, login to that user, and run Terminal there. Assuming the installation didn't bork the system-wide shell profiles, that Terminal should work. Then it's just a matter of elevating privilege and moving the failing profiles out of the way.

    It would provide some useful context for diagnosis if you told us exactly what procedure you were following for installing Apache, PHP and mySQL. Post a URL of whatever instructions or download you used, and exactly how far you got in the process.
  3. 66Mike99, Jan 17, 2015
    Last edited by a moderator: Jan 18, 2015

    66Mike99 thread starter macrumors newbie

    Jan 17, 2015
    Alberta Canada
    Thankyou for the help.

    Here is the result from Automator "Run Shell Script":

    total 120
    drwxr-xr-x+ 30 mikeburgess  staff   1020 Jan 16 12:04 .
    drwxr-xr-x   5 root         admin    170 Jan  8 21:22 ..
    -r--------   1 mikeburgess  staff      7 Jan  8 21:35 .CFUserTextEncoding
    -rw-r--r--@  1 mikeburgess  staff  28676 Jan 17 12:25 .DS_Store
    drwx------  10 mikeburgess  staff    340 Jan 17 14:28 .Trash
    -rw-------   1 mikeburgess  staff   2710 Jan 15 13:51 .bash_history
    -rw-r--r--   1 mikeburgess  staff     73 Jan 15 12:26 .bash_profile
    -rw-------   1 mikeburgess  staff     75 Jan 15 12:22 .mysql_history
    -rw-r--r--   1 mikeburgess  staff    243 Jan 12 19:55 .profile
    -rw-------   1 root         staff    682 Jan 15 11:20 .viminfo
    drwx------   3 mikeburgess  staff    102 Jan  9 17:26 Applications
    drwxr-xr-x   7 mikeburgess  staff    238 Jan  9 11:37 Day by Day
    drwx------+  4 mikeburgess  staff    136 Jan 17 14:28 Desktop
    drwxr-xr-x   4 mikeburgess  staff    136 Jan  9 11:25 Devon Nordic
    drwx------+  6 mikeburgess  staff    204 Jan 10 11:44 Documents
    drwx------+ 14 mikeburgess  staff    476 Jan 17 11:07 Downloads
    drwx------@ 49 mikeburgess  staff   1666 Jan 16 09:07 Library
    drwx------+  3 mikeburgess  staff    102 Jan  8 17:05 Movies
    drwx------+  4 mikeburgess  staff    136 Jan 14 18:13 Music
    drwxrwxrwx  13 mikeburgess  staff    442 Jan  9 17:15 Old Desktop
    drwxr-xr-x  13 mikeburgess  staff    442 Jan  9 11:55 Out of the Box
    drwxrwxrwx  14 mikeburgess  staff    476 Jan  9 12:01 Passive House
    drwxr-xr-x  30 mikeburgess  staff   1020 Jan 10 13:31 Photos
    drwx------@ 31 mikeburgess  staff   1054 Jan  9 13:03 Pictures
    drwxr-xr-x+  5 mikeburgess  staff    170 Jan  8 17:05 Public
    drwxr-xr-x   5 mikeburgess  staff    170 Jan 16 07:44 Sites
    drwxr-xr-x   3 mikeburgess  staff    102 Jan 16 12:01 Test
    drwxrwxrwx   3 mikeburgess  staff    102 Jan  9 11:58 Toastmasters
    -rw-r--r--   1 mikeburgess  staff    307 Jan 15 10:11 Untitled.rtf
    drwxrwxrwx  10 mikeburgess  staff    340 Jan  9 12:05 White Earth Construction Inc

    This is the tutorial I was using:


    In the "User Level Root" I did not get the listed response to Permissions on the file but everything seemed to work.

    MySQL loaded and could be started and stopped through System Preferences and I continued on following the tutorial. Once I came to loading a new server in phpmyadmin. I see I can define a server there now but not save it as there is no .config folder. I believe I created a config folder in OS X, and am not sure wether it was web server writable or not. At one point here I was asked to login using my password but denied access. Looking to Terminal to try to resolve the issue I found that terminal would no longer login.

    The 15 lines of code I had pasted into /Library/LaunchDaemons/com.mysql.mysql.plist I then removed.

    I apoligize for not keeping records of what worked and what did not at each step.

    I appreciate your help Mike
  4. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    Now try this:
    mkdir -p ~/bad
    mv ~/.bash_profile ~/bad/bash_profile
    mv ~/.profile ~/bad/profile
    Paste the above 3 lines into a single Run Shell Script action in a Workflow. Run it.

    It won't produce any output, but it should do the following:
    1. Create a folder named "bad" in your home folder.
    2. Move two files there: "bash_profile" and "profile".

    Look in the folder "bad", and if you see both files, then quit Terminal (if not already done) and relaunch it.

    Does the Terminal window work correctly?

    If so, then zip the two files in the "bad" folder and post them as an attachment. You can look at them in TextEdit first (drag onto TextEdit to open) and make sure they contain nothing compromising. They probably won't, but who knows.

    If the Terminal window DOESN'T work, the problem likely resides at a deeper level and will take additional corrections.

    It'll take a while to walk through the tutorial and figure things out. Having the bash_profile and profile might provide some important clues on that, so posting them could be useful.
  5. 66Mike99 thread starter macrumors newbie

    Jan 17, 2015
    Alberta Canada
    Terminal Login failed

    Yes, that seems to have done the trick.

    Here are the files zipped. Thanks again Mike

    Attached Files:

  6. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    The source of the problem is in the file originally located at "~/.bash_profile". Its contents were:
    export PATH="/usr/local/mysql/bin:$PATH"
    source ~/.bash_profile
    mysql -v
    The specific problem is in line 2. It tells the shell to read from "~/.bash_profile", i.e. it tells the shell to read commands from itself. The shell will do this, then encounter yet another command to read from "~/.bash_profile", which leads to yet another command to read from "~/.bash_profile", which leads to... infinite recursion.

    I'm not going to experiment to discover what eventually limits this infinite recursion, but based on your earlier post it takes about 15 seconds to hit that limit. At that point the shell terminates.

    Looking at the linked tutorial, I searched for the word "source".

    Reading a few paragraphs there, it looks like your mistake arose here:
    Exit the file with type “control + x” and when prompted save the change by typing “y”.​
    That is, when you're editing ~/.bash_profile, it should contain exactly one line:
    export PATH="/usr/local/mysql/bin:$PATH"
    You should then SAVE the file and EXIT the nano editor. At that point you'll be back at the shell prompt. THAT'S where you execute the next two commands:
    source ~/.bash_profile
    mysql -v
    That is, DO NOT put those two lines into "~/.bash_profile".

    The original "~/.profile" appears to be fine. You can copy it back into place with this command:
    cp ~/bad/profile ~/.profile
    I don't think it will matter, because bash won't use it. From the bash man page:
    When bash is invoked as an interactive login shell, or as a non-inter-
    active shell with the --login option, it first reads and executes com-
    mands from the file /etc/profile, if that file exists. After reading
    that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
    in that order, and reads and executes commands from the first one that
    exists and is readable. ...
    If you're still using MacPorts, then you'll need to reconcile ~/.bash_profile with ~/.profile.
  7. 66Mike99 thread starter macrumors newbie

    Jan 17, 2015
    Alberta Canada
    Much appreciated. I had thought I could simply follow instructions without having to work things through myself. Possibly I don't follow instructions all that well. Imagine that!!
  8. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    This is one reason I will often use a newly created account for such adventures. If I bork something in the new account, I lose nothing by deleting it. I also usually take notes along the way, so I can reuse them later if I decide to apply to my main account.

    Your tutorial used a lot of 'sudo' actions, so a lot of what it does will be system-wide. The safe thing there is a full backup before starting. Or a full backup, boot from that backup, and perform the tutorial on the backup. Again, if something goes wrong, the original is still safe and ready to go.

Share This Page