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?
export PATH=/bin:/usr/bin:"$PATH"– asveikau Jul 31 '10 at 18:43