0

I was following a tutorial on updating my Mac to PHP 5.4. Things were going well until I had to step away. Now I don't remember where I left off and couldn't find the same tutorial any more. I did get as far as creating the my_phpinfo.php file, but when I brought it up, it showed 5.3.

I end up digging and digging, then turning to Homebrew. I installed Homebrew and had the standard

Consider amending your PATH so that /usr/local/bin is ahead of /usr/bin in your PATH

I followed this and it didn't work. I found the wiki for Homebrew uninstall and think I'm in worse shape. After trying to reinstall, I get

-bash: curl: command not found
-bash: ruby: command not found

I decided to try to restart Apache

-bash: sudo: command not found

Now I'm stuck. Can anyone help?

Community
  • 1
  • 1
abchase
  • 15
  • 3
  • What does your /etc/paths file contain? – Chris B Sep 12 '13 at 21:16
  • Did a bit more digging. I'm fairly certain that my paths are now screwed up. That is seeing that -bash won't recognize any commands... Unless you can tell me another way to ls that may work, ls isn't working either – abchase Sep 12 '13 at 21:16

1 Answers1

0

You seem to have erased your /etc/paths file. Your path specifies places to look for programs so that you don't have to type the full path every time you wish to use them. NOTE: typing /bin/bash and /bin/ls should work for you...

I suggest you open the /etc/paths file in a text editor and check that it looks like this:

/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
/usr/local/sbin

To do this from the command line you would need to type:

/usr/bin/nano /etc/paths

If you prefer to use vim then exchange nano for vim and if you need elevated permissions then prefix the command with "/usr/bin/sudo".

After you've done this close and reopen the terminal and you should find the terminal working normally again.

If this doesn't work, your path will most likely be being set in one or many of: /etc/profile, ~/.bash_profile, ~/.bash_login or ~/.profile. Check these files exist and if they do, check for mentions of PATH in them and ensure it is getting set with the correct values.

Chris B
  • 925
  • 4
  • 14
  • Well that did get me in to edit paths. You were right, `/usr/local/sbin` was missing. Restarted terminal. Went into `/etc/` and used `ls` `-bash: ls: command not found` – abchase Sep 12 '13 at 22:03
  • Does this help? `$ echo $PATH /usr/local/bin:/usr/local/bin:/Users/username/Library/Application` – abchase Sep 13 '13 at 01:49
  • yes it does. "ls" is in "/bin" and that's not on your path. Also "/usr/local/sbin" isn't mentioned... Can you show me what's in /etc/paths please? – Chris B Sep 13 '13 at 08:23
  • I was able to edit per your instructions. `/usr/bin /bin /usr/sbin /sbin /usr/local/bin /usr/local/sbin` – abchase Sep 13 '13 at 15:34
  • Can you look and see whether the file ~/.bash_profile exists in on your system? If it does, open it and check to see you see the line starting "export $PATH" exists. If it does either remove it or ensure all of the /etc/paths entries are included. – Chris B Sep 13 '13 at 15:46
  • Hey, I think I answered a bit too fast. Although that is the contents of path. When I started terminal this morning I notices a message. `-bash: export: 'Support/GoodSync:/usr/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin': not a valid identifier` – abchase Sep 13 '13 at 16:00
  • Okay, that means your path is being set in a script that runs on the Terminal launch. Most likely it will be in one or many of: /etc/profile, ~/.bash_profile, ~/.bash_login or ~/.profile. Check these files exist and if they do, check for mentions of PATH in them and ensure it is getting set with the values I put in my answer. – Chris B Sep 13 '13 at 16:37
  • /etc/profile : `# 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` – abchase Sep 14 '13 at 01:42
  • ~/.bash_profile : `export PATH="/Users/adambchase/Library/Application Support/GoodSync":$PATHexport PATH=/usr/local/bin:/Users/adambchase/Library/Application Support/GoodSync:/$ export PATH=/usr/local/bin:/Users/adambchase/Library/Application Support/GoodSync:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin export PATH=/usr/local/bin:/usr/local/bin:/Users/adambchase/Library/Application` ~/bash_login : `EMPTY` ~/.profile : `EMPTY` – abchase Sep 14 '13 at 01:51
  • Got rid of the first 2 lines in the .bash_profile. That got rid of the export error. Was unsure of the 3rd line though. Restarted Term, no export error on startup. – abchase Sep 14 '13 at 02:00