4
4
In the course of trying to install something on my Mac OSX machine, I think I have broken my ~/.bash_profile file. I edited it, and suddenly, now, when I open a terminal, I can't run anything, or even list files:
$ ls
-bash: ls: command not found
Oh no! I try to open emacs to edit ~/.bash_profile, but I can't:
$ emacs ~/.bash_profile
-bash: emacs: command not found
$ port install emacs
MacPorts running without privileges. You may be unable to complete certain actions (eg install).
---> Computing dependencies for emacs
MacPorts running without privileges. You may be unable to complete certain actions (eg install).
---> Fetching emacs
---> Attempting to fetch emacs-23.2.tar.gz from http://www.mirrorservice.org/sites/ftp.gnu.org/gnu/emacs
MacPorts running without privileges. You may be unable to complete certain actions (eg install).
---> Verifying checksum(s) for emacs
MacPorts running without privileges. You may be unable to complete certain actions (eg install).
---> Extracting emacs
MacPorts running without privileges. You may be unable to complete certain actions (eg install).
MacPorts running without privileges. You may be unable to complete certain actions (eg install).
---> Configuring emacs
MacPorts running without privileges. You may be unable to complete certain actions (eg install).
---> Building emacs
MacPorts running without privileges. You may be unable to complete certain actions (eg install).
---> Staging emacs into destroot
MacPorts running without privileges. You may be unable to complete certain actions (eg install).
---> Installing emacs @23.2_1
Error: Target org.macports.install returned: MacPorts requires root privileges for this action
Error: Status 1 encountered during processing.
Before reporting a bug, first run the command again with the -d flag to get complete output.
I can't sudo, and I can't change Finder to show hidden files to open it from there either:
$ sudo port install emacs
-bash: sudo: command not found
$ defaults write com.apple.Finder AppleShowAllFiles YES
-bash: defaults: command not found
Help! How can I open ~/.bash_profile to fix it?
I think your notion of what constitutes "disaster recovery" might differ somewhat to most peoples'.... – skaffman – 2010-07-31T18:35:12.510
4You can try something like:
export PATH=/bin:/usr/bin:"$PATH"
– None – 2010-07-31T18:43:21.197Sorry. I have realised that (a) this should be on superuser.com and (b) it's already been answered over there. Unfortunately it seems that I can't delete my question. I've flagged it asking for a moderator to delete it. – None – 2010-07-31T18:45:14.217
As far as I know, you should be able to delete your own question. At the bottom left of the question, above the answers but below the tags, there should be some links like "edit | delete | flag". Anyway, I'm sure a moderator or the community will take care of closing/deleting this if it's warranted. – David Z – 2010-08-01T00:45:44.737